A little tutorial on CodeFluent Entities with ASP.NET MVC4

/*

Author: Jiangong SUN

*/

CodeFluent Entities is a model-first development tool which creates non-specific database model, specific database scripts, business model objects, and different presentation projets like ASP.NET MVC, WPF etc.

I've used this tool since one week ago, so there are surely a  lot of things I've not used. Here I just want to make a simple introduction based on my experience.

Firstly, you should install codefluent entities in your computer. It's free for personal use, and you can just register in its website and get the product key to activate it.

As it is a model-first tool, you should firstly design your system model.

Firstly, create a new CF project.

A little tutorial on CodeFluent Entities with ASP.NET MVC4

Then create your database model in CodeFluent Modeler. You can add entity, property, relationship, enum etc.

The model should be located in "Surfaces"

You can create relationships in 3 ways:

1) indicate relationship when creating property, by choosing "Advanced" mode.

A little tutorial on CodeFluent Entities with ASP.NET MVC4

2) Draw relationship manually

choose an table property by pressing "Shift" key, it will draw a line, choose another property in another table. And indicate their relationship.

3) Define relationships in your model file which is located in Parts and has .cfp extension

Once you've disigned your model, you will have something like this.

A little tutorial on CodeFluent Entities with ASP.NET MVC4

Now you need to create your producers to generate sql scripts and the database.

You just need to create a producer for your database. CodeFluent Entities support several types of database like SQL Server, Oracle, MySQL, PostgreSQL, SQL Azure.

You can choose the database you want and its version, then specify target project location.

A little tutorial on CodeFluent Entities with ASP.NET MVC4

Now the database producer is created. Once you build your model project, it will generate all the sql scripts you need and your database.

Then, you need to create a BOM producer for your business object model objects. You repeat the same process, and it will be generated.

You model project will be structured like this.

A little tutorial on CodeFluent Entities with ASP.NET MVC4

Finally, you need to create your asp.net mvc4 producer.

Choose ASP.NET template in template category.

A little tutorial on CodeFluent Entities with ASP.NET MVC4

Then you build the model project, it will generate controllers and views for all the business objects.

You will surely encounter some specific problems when you try to implement your project with CodeFluent Entities. You have the official documentation and a support forum.

http://www.softfluent.com/documentation/

http://forums.softfluent.com

I hope you can enjoy this tutorial. Enjoy coding!

上一篇:何为 pimpl ?


下一篇:Maven的pom文件配置