This project is read-only.

Refresh

Jun 14, 2012 at 6:14 PM

Hi

Not sure if I am missing something here - I have setup my first project on a code-first basis; all is fine. Now I added a few additional properties and it seems the additional fields are not added to the database; so it does seem that its a once-off only entity framework and DB schema setup - is this correct?

What is the standard expected approach to this? Do I need to drop the database each time I make a change to get the refresh to take?

I dont seem to be able to find anything in the documentation or the forum here - Am I missing something here?

Thanks

Jude

Jun 14, 2012 at 6:20 PM
Stef will be able to confirm, but it certainly was the case until recently that EF didn't itself provided any schema migration features, and so NO MVC couldn't either. In other words... you need to drop the database in order to get a new one to be recreated.

The latest version of EF does, I think, have better features in this regard; but I don't know if they are exploited/enabled by NO MVC. My suspicion is "probably not".

Dan


On 14 June 2012 18:15, jude_44 <notifications@codeplex.com> wrote:

From: jude_44

Hi

Not sure if I am missing something here - I have setup my first project on a code-first basis; all is fine. Now I added a few additional properties and it seems the additional fields are not added to the database; so it does seem that its a once-off only entity framework and DB schema setup - is this correct?

What is the standard expected approach to this? Do I need to drop the database each time I make a change to get the refresh to take?

I dont seem to be able to find anything in the documentation or the forum here - Am I missing something here?

Thanks

Jude

Read the full discussion online.

To add a post to this discussion, reply to this email (nakedobjects@discussions.codeplex.com)

To start a new discussion for this project, email nakedobjects@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jun 14, 2012 at 6:26 PM

Thats fine, thanks. At least if I know thats required - thought there may be something I had missed.

Is the story for Model First or DB First any handier?

I guess for an enterprise application that you expect a lot of changes on, all things considered, which of the 3 would you recommend?

Thanks for the quick response above btw...!!

Jude

Jun 14, 2012 at 6:33 PM
There is something called Entity Framework Code First Migrations, which might be of help to you.

I prefer DB first' as it makes it trivial to modify and existing DB schema and then to update the Model from that and make custom changes if required.
And no data gets blown away.
Jun 14, 2012 at 6:33 PM
Model first is what's currently recommended.

(As you probably know), the .edmx is used to generate a .edmx.sql file, which I usually execute directly from Visual Studio, so it's no great hardship.

The other thing I recommend is to set up a companion webapp that can be reused to setup the database fixtures. The example I just posted on the other NO/RO thread actually demonstrates this: port 8080 runs the webapp, port 9090 is the fixture app (and port 7070 is RO). See [1]



~~~~
On 14 June 2012 18:26, jude_44 <notifications@codeplex.com> wrote:

From: jude_44

Thats fine, thanks. At least if I know thats required - thought there may be something I had missed.

Is the story for Model First or DB First any handier?

I guess for an enterprise application that you expect a lot of changes on, all things considered, which of the 3 would you recommend?

Thanks for the quick response above btw...!!

Jude

Read the full discussion online.

To add a post to this discussion, reply to this email (nakedobjects@discussions.codeplex.com)

To start a new discussion for this project, email nakedobjects@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jun 14, 2012 at 9:37 PM

"There is something called Entity Framework Code First Migrations, which might be of help to you."

FYI, I did some experiments with the Beta version of this a few months ago and it worked quite well.  But  -  I was looking for it the other day - I can't find any record of what exactly I did :-(    

I vaguely recall that the only issue was to work out where to put the code that captures the migrations  -  I think it necessitated another small project in the solution.  I will look at this again, soon, but meantime, if anyone else has a try, please report it on this forum.

Oct 19, 2013 at 4:30 AM
richardpawson wrote:
"There is something called Entity Framework Code First Migrations, which might be of help to you." FYI, I did some experiments with the Beta version of this a few months ago and it worked quite well.  But  -  I was looking for it the other day - I can't find any record of what exactly I did :-(     I vaguely recall that the only issue was to work out where to put the code that captures the migrations  -  I think it necessitated another small project in the solution.  I will look at this again, soon, but meantime, if anyone else has a try, please report it on this forum.
With EF 5, one would think that running the triad of a) Enable-Migrations, b) Add-Migration, and c) Update-Database should work if you specified the connectionstring parameter. This is, of course, from the Model project and not the MVC project. Any of the NO users have experience with successful code first migration patterns?
Oct 19, 2013 at 10:24 AM
I have been using Code First Migrations recently, and it did not require any special changes to work with Naked Objects - I just followed the standard Microsoft practices. Sometimes a little confusing as to what it does - but on the whole I think this is very promising and I intend to use it more.