Advice/Docs on using ED generated code in MVC applications?

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
EdB
Posts: 91
Joined: Mon 15 Oct 2012 09:24

Advice/Docs on using ED generated code in MVC applications?

Post by EdB » Thu 24 Jan 2013 01:34

(Reposted from incorrect forum)

Hi,

Just wondering whether there is some information showing how to setup the generated code to CRUD in the MVC layer. Also what are the settings for the Web.config?

Also I am a little confused about which entity pattern to use ie

EntityObject
POCO Entity
Self-Tracking
DbContext
Repository and Unit of Work.

Many thanks,

Ed

EdB
Posts: 91
Joined: Mon 15 Oct 2012 09:24

Re: Advice/Docs on using ED generated code in MVC applications?

Post by EdB » Thu 24 Jan 2013 01:39

I have been doing some work on this, especially with the EntityObject pattern since it seems a good one to start with.

I am just adding a controller in my MVC application, and I can see the Entities and the Context. However the "Add Controller" then falls over as it cannot see the meta files which are in the Models project.

I added the following to the web.config.

Code: Select all

    
<add name="MyDB_Entities" connectionString="metadata=MyDB.csdl|MyDB.ssdl|MyDB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=MyServer\mssql2008;Initial Catalog=MyDB;Integrated Security=True;Persist Security Info=True;MultipleActiveResultSets=True;Application Name=EntityFramework"" providerName="System.Data.EntityClient" />
There is no App.config in the ED Models project. Perhaps I need one here as well?

Ed

EdB
Posts: 91
Joined: Mon 15 Oct 2012 09:24

Re: Advice/Docs on using ED generated code in MVC applications?

Post by EdB » Thu 24 Jan 2013 12:19

Perhaps Entity Developer Classes do not work with MVC's Scaffolding? Cannot see why since we are still using Entity Framework.

Also I am using standalone Entity Developer, and regenerated the Classes with Metadata Artifact Processing" set to "Do not generate Mapping Files" in the belief that the files are embedded. However this did not work. Perhaps this is the approach and my web.config is still wrong.

Getting slightly frustrated. I going to try a fresh EDeveloper project using the VS integrated Entity Developer setup and reverse engineer the DB and then regen the classes to see if this makes any difference.

Any advice ..... is greatly appreciated.

Thanks,

Ed

EdB
Posts: 91
Joined: Mon 15 Oct 2012 09:24

Re: Advice/Docs on using ED generated code in MVC applications?

Post by EdB » Fri 25 Jan 2013 01:35

Sorted Now. It does work. Just have to be careful that the metafiles are embedded. Also this worked in the VS integrated version of ED, and I initially had problems with the standalone version, so I will test the standalone version again, now that I know what I am doing !!

Post Reply