edmx

How can I make the Entity data model designer use my database column descriptions?

大兔子大兔子 提交于 2019-11-27 02:40:37
问题 I am using EF4 with Visual Studio 2010. I have a SQL database already created and all my columns are documented with the Description property in SQL management studio. When I create the edmx in Visual Studio, how can I make it read those descriptions and use them to add comments to my generated classes? I know I can use the Summary and LongDescription in the edmx properties but I'm looking for a way to do this without having to copy and paste every description. Thanks! 回答1: There is a feature

Tool to convert Entity Framework EDMX to Code First

陌路散爱 提交于 2019-11-27 01:46:22
问题 Is there a tool to convert an edmx into code-first? I know there was talk of one appearing in a CTP a while back, but I can't find any updates relating to this. There's a guy on the MSDN forums who has written his own (not available yet), but nothing from the EF team. 回答1: There is no such tool because EDMX offers much more features which cannot be translated into code-first. The only tool available are EF Power Tools CTP1 which allow creating code-first mapping from existing database but it

Error: “The specified LINQ expression contains references to queries that are associated with different contexts”

為{幸葍}努か 提交于 2019-11-26 22:18:11
I am receiving the error shown in the title from a LINQ query that includes two tables from two different edmx files. Here is the query: var query = (from a in db1.Table1 join b in db1.Table2 on a.Id equals b.Id orderby a.Status where b.Id == 1 && a.Status == "new" select new { Id = a.Id, CompanyId = (from c in db2.Company where s.Id == a.Id select new { c.CompanyId }) }); db1 and db2 are contexts that are associated with two different edmx files. How can I overcome this error? Allon Guralnek You'll have to perform two database queries: var IDs = (from a in db1.Table1 join b in db1.Table2 on a

How do you update an edmx file with database changes?

旧时模样 提交于 2019-11-26 10:19:16
问题 I have an edmx file and I changed a table in my database. I know that there is an \"Update Model from database\" wizard, however in many cases this is useless. For example if I change a field from non null to nullable or if I remove fields the update model does not reflect the changes. I have had to remove the entity and add it back in to get the changes to appear in my model. Per the following question: How do I propagate database changes to my .edmx file? One of the answers seems to say the

Error: “The specified LINQ expression contains references to queries that are associated with different contexts”

南笙酒味 提交于 2019-11-26 08:15:19
问题 I am receiving the error shown in the title from a LINQ query that includes two tables from two different edmx files. Here is the query: var query = (from a in db1.Table1 join b in db1.Table2 on a.Id equals b.Id orderby a.Status where b.Id == 1 && a.Status == \"new\" select new { Id = a.Id, CompanyId = (from c in db2.Company where s.Id == a.Id select new { c.CompanyId }) }); db1 and db2 are contexts that are associated with two different edmx files. How can I overcome this error? 回答1: You'll

Entity Framework: Where do I extend the CSDL/MSL?

自闭症网瘾萝莉.ら 提交于 2019-11-26 03:56:27
问题 I\'m using Entity Framework 4. I am using a database first model, meaning that I generated the EDM from the database. Now I want to add some model-defined functions. My question is ... where? If I put them in the .edmx file, won\'t all my additions be clobbered the next time I update the database and generate the new EDM? I mean it says it right there at the top of the .Designer.cs file, \"Manual changes to this file will be overwritten if the code is regenerated.\" So, in what file do I put