tag:blogger.com,1999:blog-6082652835152798567.post8474464192245894261..comments2024-03-28T00:58:12.736-07:00Comments on Sql server, .net and c# video tutorial: Part 6 - How to seed database with test data using entity frameworkUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-6082652835152798567.post-87808813181059057572020-12-21T07:51:50.711-08:002020-12-21T07:51:50.711-08:00If your code doesn't work, it's because he...If your code doesn't work, it's because here seeder class is inheriting from 'DropCreateDatabaseIfModelChanges', so if you don't change your entity class each time in any form e.g. adding new property like 'JobTitle', it won't recreate the database.<br />So to solve the problem you can make seeder class inherit from 'DropCreateDatabaseAlaways' instead.Debarghya_23https://www.blogger.com/profile/05934478917903847293noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-26585865174195267132017-07-10T02:20:42.946-07:002017-07-10T02:20:42.946-07:00In some scenario, Seed method is not working, At t...In some scenario, Seed method is not working, At this time we need to do below changes in global.asax file<br /><br />protected void Application_Start(object sender, EventArgs e)<br /> {<br /> Database.SetInitializer(new EmployeeDBContextSeeder());<br /> var db = new EmployeeDBContext();<br /> db.Database.Initialize(true);<br /> }Vinod Kumarhttps://www.blogger.com/profile/08644719402489309095noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-30631388167868965082016-06-10T06:05:58.915-07:002016-06-10T06:05:58.915-07:00no need to specify.. its autogenrated by sql serve...no need to specify.. its autogenrated by sql server... IdenditySubhashhttps://www.blogger.com/profile/09316289881528375815noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-13439466719543537452016-05-07T00:21:41.560-07:002016-05-07T00:21:41.560-07:00OK. It's working fine. What the problem is aft...OK. It's working fine. What the problem is after executing above code if I add a new employee entry in any department then that new employee's entry is not saving into the database table. Why? <br />But if I manually drop the database then it displays the record but it's wrong way. How to do this?Anonymoushttps://www.blogger.com/profile/07272632082700489494noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-22549351226096115982016-02-17T22:18:21.286-08:002016-02-17T22:18:21.286-08:00Can you please suggest me where it specifies, ID c...Can you please suggest me where it specifies, ID column is Primary key and identity columnAnkit Shivharehttps://www.blogger.com/profile/15504582030002410509noreply@blogger.com