Entity Framework Merge Nightmare

Craig Stuntz does a good job of explaining that it is the designer related xml (the positions of entities and associations etc on the design surface) that causes most of the problems here. Conflict resolution within the edmx:Runtime element however, is very achievable. The best strategy for dealing with conflicts in the designer related xml … Read more

How can I get a PDB file for the EntityFramework NuGet package?

Now with pictures (as it took me about an hour of trial and fail) Get DotPeek from Jetbrains (Standalone version) Open DotPeek -> File -> Open -> browse to your project bin folder and open EntityFramework.dll Right mouse button on EntityFramework then choose Generate Pdb… Go to folder where you exported it and open EntityFramework.pdb … Read more

Entity Framework Code First and Connection String Issue

For EF Code First you can use ordinary connection string if you are using SQL Server. <add name=”DataContext” connectionString=”Data Source=myserver.com;Initial Catalog=MyDataBase;Persist Security Info=True;User ID=username;Password=password” providerName=”System.Data.SqlClient” />

Adding CreatedDate to an entity using Entity Framework 5 Code First

Here is how I did it: [DatabaseGenerated(DatabaseGeneratedOption.Computed)] public DateTime CreatedDate{ get; set; } in my migration’s Up() method: AddColumn(“Agents”, “CreatedDate”, n => n.DateTime(nullable: false, defaultValueSql: “GETUTCDATE()”));

Entity Framework migrations stopped detecting the POCO updates

This may be in two reasons: There is some other DbContext in code, that’s why automatic migrations could not decide, which context to use. There is some new change, which loops a comparison of schema and code model, so EF simply could not find the difference. In general, automatic migrations are simple and fast to … Read more

Why is ON DELETE SET NULL still not implemented in the Entity Framework 6? Is there a snag?

The feature is probably not implemented because normally changes only affect the objects which are actually in the unit of work. Cascades are not scalable. And I also think soft deletes are better in most cases. Maybe thats something for you? You might also want to look into Domain Driven design. That also covers the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)