entity-framework-5

Entity Framework 5 not installing correctly?

限于喜欢 提交于 2019-12-25 18:16:11
问题 I just installed VS 2012. I created a new project to do Code First with. I then used Nuget to add EF5 to the project, as per these instructions: http://msdn.microsoft.com/en-us/data/ee712906 I then verified it's install: http://i1048.photobucket.com/albums/s361/usernames_r_stupid/Nuget_zpse7808c9b.png Which shows that I have EF 5 installed. And indeed my App.config shows: <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework,

One to Zero or One relationship with EF5 fluent mapping

有些话、适合烂在心里 提交于 2019-12-25 16:46:15
问题 I have three entities: public class MainEntity() { public long Id { get; set; } public long EntityAId { get; set; } public EntityA OptionalEntityA { get; set; } public long EntityBId { get; set; } public EntityB OptionalEntityB { get; set; } public string SProp { get; set; } } public class EntityA() { public long Id { get; set; } public long MainEntityId { get; set; } public MainEntity RequiredEntity { get; set; } } public class EntityB() { public long Id { get; set; } public long

DeleteDatabase is not supported by the provider

筅森魡賤 提交于 2019-12-25 07:24:06
问题 I'm using EF Code First with SQL Express 2012. Everything worked fine until now. I'm getting this error: DeleteDatabase is not supported by the provider. public class SqlServerContext : DbContext { public DbSet<Estimate> Estimates { get; set; } public SqlServerContext(String connectionString) :base(connectionString) { Database.SetInitializer(new SqlServerContextInitializer()); } } public class SqlServerContextInitializer : DropCreateDatabaseAlways<SqlServerContext> { } Did anyone have similar

No results yet no error with N-Tier Entity Framework

梦想与她 提交于 2019-12-25 05:22:20
问题 I have created a demo project using the N-Tier Entity Framework VS2012. the problem is that there are no results returned no mather what i request. No Errors are thrown of detected? Any suggestions here are welcome? 回答1: Make sure to call the AsQueriable() method for requesting data from the backend. N-Tier Entity Framework supports both, local and remote queries. While e.g. context.Orders.ToList() only returns what’s already in client memory, you can call context.Orders. AsQueriable()

No results yet no error with N-Tier Entity Framework

我怕爱的太早我们不能终老 提交于 2019-12-25 05:22:02
问题 I have created a demo project using the N-Tier Entity Framework VS2012. the problem is that there are no results returned no mather what i request. No Errors are thrown of detected? Any suggestions here are welcome? 回答1: Make sure to call the AsQueriable() method for requesting data from the backend. N-Tier Entity Framework supports both, local and remote queries. While e.g. context.Orders.ToList() only returns what’s already in client memory, you can call context.Orders. AsQueriable()

Entity Framework 5 - Is it possible to load relationships (associations) without lazy and eager loading?

狂风中的少年 提交于 2019-12-25 04:58:09
问题 I'm trying to develop a generic repository on Entity Framework 5 for get data from any table and I want to use disconnected context without lazy and eager loading. Is it possible? I'm using the code below, but it doesn't works: T it's entity type. public IList<T> GetData(Expression<Func<T, bool>> expression) { using (var context = new Context()) { return context.Set<T>().Where(expression).ToList(); } } Just the main entity it's loaded, the relationships no. 来源: https://stackoverflow.com

Keyword not supported: 'metadata' + MySQL

夙愿已清 提交于 2019-12-25 02:53:06
问题 The error When it happens I'm attempting to create a simple controller using a ViewModel as model. Connection String <connectionStrings> <add name="BoaPropostaEntities" connectionString="metadata=res://*/Models.MyApp.csdl|res://*/Models.MyApp.ssdl|res://*/Models.MyApp.msl;provider=MySql.Data.MySqlClient;provider connection string='server=localhost;user id=root;password=root;persistsecurityinfo=True;database=mydatabase'" providerName="MySql.Data.MySqlClient"/> Web.Config spotlight I also added

Entity Framework 5 library consumers need entity framework dlls?

无人久伴 提交于 2019-12-25 02:44:10
问题 I have a Project "Project.EntityFramework" which contains a context to my db. When attempting to consume the context from a separate project within the same solution "Project.Business" like: using (var db = new EntityFramework.Entities()) { // Code } I get the compiler error on "using": Error 12 'EntityFramework.Entities': type used in a using statement must be implicitly convertible to 'System.IDisposable' .... Now I can F12 and drill down to the Entities, and see it is implementing

Load Operation failed for query 'Login'. The remote server returned an error: NotFound

与世无争的帅哥 提交于 2019-12-25 02:17:16
问题 I'm working with Siverlight 5.0, RIA Services and Entity framework in my project. When I deploy the application using VS, the application runs fine. However, when I use a web deployment project to publish the application, the first call to a RIA services service on the same system fails. An error similar to this is produced: Load Operation failed for query 'Login'. The remote server returned an error: NotFound I guess, the last message is not enough to get the concrete error. Suggest me what

Entity Framework include items only by condition [duplicate]

偶尔善良 提交于 2019-12-25 01:16:28
问题 This question already has answers here : EF: Include with where clause (2 answers) Closed 3 years ago . I need my context to include the sonns by a condition, I need the rows that not deleted (logical delete). I understood that I cannot add a condition to the include; so I want to filter the context, but it's not working. var aa = ctx.aa .Include(t => t.vari) .ToList() .FirstOrDefault(); ctx.vari.Where(bi => bi.ID == 10 && bi.Deleted == 1).ToList(); Thanks! 回答1: As codelahiru && hbulens