entity-framework

Where to find .csdl, .ssdl, and .msl files in Entity Framework 4.0 code first?

﹥>﹥吖頭↗ 提交于 2020-05-28 22:29:02
问题 I want to run tests with Effort and to do that I need to specify a connectionstring that also contains a reference to .csdl, .ssdl , and .msl files. The (non-working) connectionstring looks like this now: <add name="SQLAzureConnection" connectionString= "metadata=res://*/Model.projectContext.csdl| res://*/Model.projectContext.ssdl|res://*/Model.projectContext.msl; provider=System.Data.SqlClient; provider connection string="Data Source=(LocalDb)\v11.0;Initial Catalog=Database_Nieuw;Integrated

Where to find .csdl, .ssdl, and .msl files in Entity Framework 4.0 code first?

浪子不回头ぞ 提交于 2020-05-28 22:22:39
问题 I want to run tests with Effort and to do that I need to specify a connectionstring that also contains a reference to .csdl, .ssdl , and .msl files. The (non-working) connectionstring looks like this now: <add name="SQLAzureConnection" connectionString= "metadata=res://*/Model.projectContext.csdl| res://*/Model.projectContext.ssdl|res://*/Model.projectContext.msl; provider=System.Data.SqlClient; provider connection string="Data Source=(LocalDb)\v11.0;Initial Catalog=Database_Nieuw;Integrated

How can I build logic upon supplied logic in a LINQ-to-Entities Where expression?

大憨熊 提交于 2020-05-28 12:05:12
问题 I often come across, in LINQ for Entity Framework, a pattern where I add a .Where clause if a string value is specified, like: IQueryable<Foo> query = Foos.AsQueryable() if (!string.IsNullOrWhitespace(nameFilter)) query = query.Where(x => x.Name == name); if (!string.IsNullOrWhitespace(addressFilter) != null) query = query.Where(x => x.Address == addressFilter ); if (!string.IsNullOrWhitespace(cityFilter) != null) query = query.Where(x => x.City == cityFilter ); // ... I wanted to clean this

Avoid Query Client Evaluation error on a query with method definition inside entity class

*爱你&永不变心* 提交于 2020-05-28 03:43:13
问题 In a .NET Core 2.1 project, I'm using EF Core with Command pattern (using MediatR library) on a SQL Server database. I setup the project to avoid client query evaluation, by using these settings: var phaseOptions = new DbContextOptionsBuilder<PhaseDbContext>().UseSqlServer(configuration.GetConnectionString("PhaseDbContext"), sqlServerOptions => sqlServerOptions .EnableRetryOnFailure( maxRetryCount: 5, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null)) .ConfigureWarnings

How to pass a EF DB First connection string via constructor instead put in app.config

Deadly 提交于 2020-05-27 12:14:42
问题 I'm developing a DataBase First EF application and everything is working great with the auto-generated code and app.config sections. But when I try to remove the connection string of the app.config and put it as parameter on the DbContext constructor I cannot get it to work. The connection string in the app.config: <add name="EntityContext" connectionString="metadata=res://*/ModelHistory.csdl|res://*/ModelHistory.ssdl|res://*/ModelHistory.msl;provider=Oracle.ManagedDataAccess.Client;provider

may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints

Deadly 提交于 2020-05-27 12:03:28
问题 Entity Framework Core Throwing error while doing update-database Error:- Introducing FOREIGN KEY constraint 'FK_UserRoleRelationship_UserRoels_ParentUserRoleId' on table 'UserRoleRelationship' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint or index. public class UserRoleRelationship { [Key] public int Id { get; set; } [Required] public Guid UserRoleRelationshipId { get; set; }

may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints

时间秒杀一切 提交于 2020-05-27 12:02:33
问题 Entity Framework Core Throwing error while doing update-database Error:- Introducing FOREIGN KEY constraint 'FK_UserRoleRelationship_UserRoels_ParentUserRoleId' on table 'UserRoleRelationship' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint or index. public class UserRoleRelationship { [Key] public int Id { get; set; } [Required] public Guid UserRoleRelationshipId { get; set; }

may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints

浪尽此生 提交于 2020-05-27 12:01:31
问题 Entity Framework Core Throwing error while doing update-database Error:- Introducing FOREIGN KEY constraint 'FK_UserRoleRelationship_UserRoels_ParentUserRoleId' on table 'UserRoleRelationship' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint or index. public class UserRoleRelationship { [Key] public int Id { get; set; } [Required] public Guid UserRoleRelationshipId { get; set; }

may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints

时光总嘲笑我的痴心妄想 提交于 2020-05-27 12:01:29
问题 Entity Framework Core Throwing error while doing update-database Error:- Introducing FOREIGN KEY constraint 'FK_UserRoleRelationship_UserRoels_ParentUserRoleId' on table 'UserRoleRelationship' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint or index. public class UserRoleRelationship { [Key] public int Id { get; set; } [Required] public Guid UserRoleRelationshipId { get; set; }

Unable to create an object of type 'MyContext'. For the different patterns supported at design time

 ̄綄美尐妖づ 提交于 2020-05-26 11:18:08
问题 I have ConsoleApplication on .NET Core and also i added my DbContext to dependencies, but howewer i have an error: Unable to create an object of type 'MyContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728 i've added: var context = host.Services.GetRequiredService<MyContext>(); Also i've added private readonly DbContextOptions<MyContext> _opts; in my Post Class: using (MyContext db = new MyContext(_opts)) { db.Posts.Add(postData);