entity-framework-6

Can't create .edmx file for postgresql use entityframework + npgsql

佐手、 提交于 2021-01-29 03:35:34
问题 I want to create ADO.NET entity data model - database first (.edmx file) with EntityFramework6.Npgsql but it's error. I have installed: - EntityFramework6.Npgsql (version 6.3 newest) - Npgsql (version 4.1.1 newest) - EntityFramework (version 6.3 newest) I created it before, but I don't know why now! Please help me.... 回答1: This is a known issue that is already tracked on github In the meantime for those having issues with the latest version of the VSIX (4.1.1.2), please downgrade back to 4.0

Entity Framework 6 one to many relationship

眉间皱痕 提交于 2021-01-28 08:14:53
问题 I develop web application with Entity framework 6. I have a model Folder that contains a list of Letter object. My letter object: public class Letter { [Key] public int Id [ForeignKey("Folder")] public int FolderId {get; set;} public virtual Folder Folder {get; set;} } I have 2 dbsets in my DbContext: DbSet<Folder> DbSet<Letter> My question is what happens when I add a new Letter? If I later on fetch the folder I added the letters, will those letters be contained in the folder's letters list?

JetBrains Rider enable-migrations for ASP.NET MVC on mac

[亡魂溺海] 提交于 2021-01-28 03:10:28
问题 I have JetBrains Rider 2018.3 on macOS Mojave. I created an ASP.NET MVC project, installed entity framework 6.2. I added the connection string to web.config. But, I don't know how to configure app.config. I want to enable-migrations for this project to connect to the Microsoft SQL Server. I googled it and found this link Entity Framework Support in Rider. However, I am not able to find Tools | Entity Framework | Initial setup . I was wondering if you could help me to solve this issue. 回答1:

Entity Framework Error when using Unity

落花浮王杯 提交于 2021-01-27 16:31:24
问题 On trying to resolve my service class, I'm getting an error that DbContext cannot be constructed because it's an abstract class. The error message is here: Unity.Exceptions.ResolutionFailedException: 'Resolution of the dependency failed, type = 'MyService.MyClass', name = '(none)'. Exception occurred while: while resolving. Exception is: InvalidOperationException - The current type, System.Data.Common.DbConnection, is an abstract class and cannot be constructed. Are you missing a type mapping

Entity Framework 6 creates Id column even though other primary key is defined

守給你的承諾、 提交于 2021-01-27 05:31:16
问题 I defined a DataObject as: public class SensorType : EntityData { //PKs public string CompanyId { get; set; } public string ServiceId { get; set; } public string Type { get; set; } } And used fluent API to make CompanyId and ServiceId a composite key: modelBuilder.Entity<SensorType>() .HasKey(t => new { t.CompanyId, t.ServiceId }); //No autogeneration of PKs modelBuilder.Entity<SensorType>().Property(t => t.ServiceId) .HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema

Entity Framework 6 creates Id column even though other primary key is defined

ぐ巨炮叔叔 提交于 2021-01-27 05:30:42
问题 I defined a DataObject as: public class SensorType : EntityData { //PKs public string CompanyId { get; set; } public string ServiceId { get; set; } public string Type { get; set; } } And used fluent API to make CompanyId and ServiceId a composite key: modelBuilder.Entity<SensorType>() .HasKey(t => new { t.CompanyId, t.ServiceId }); //No autogeneration of PKs modelBuilder.Entity<SensorType>().Property(t => t.ServiceId) .HasDatabaseGeneratedOption(System.ComponentModel.DataAnnotations.Schema

One to many recursive relationship with Code First

左心房为你撑大大i 提交于 2021-01-27 04:27:52
问题 I am trying to implement a simple self referencing relationship with EF 6.1.2 Code First. public class Branch { [Key] public int Id { get; set; } [Required] public string Name { get; set; } public int? ParentId { get; set; } [ForeignKey("ParentId")] public virtual Branch Parent { get; set; } public ICollection<Branch> Children { get; set; } // direct successors } In my application I have exactly one root branch. And except for this single root branch, every branch has exactly one parent (the

One to many recursive relationship with Code First

不羁的心 提交于 2021-01-27 04:27:05
问题 I am trying to implement a simple self referencing relationship with EF 6.1.2 Code First. public class Branch { [Key] public int Id { get; set; } [Required] public string Name { get; set; } public int? ParentId { get; set; } [ForeignKey("ParentId")] public virtual Branch Parent { get; set; } public ICollection<Branch> Children { get; set; } // direct successors } In my application I have exactly one root branch. And except for this single root branch, every branch has exactly one parent (the

One to many recursive relationship with Code First

萝らか妹 提交于 2021-01-27 04:23:13
问题 I am trying to implement a simple self referencing relationship with EF 6.1.2 Code First. public class Branch { [Key] public int Id { get; set; } [Required] public string Name { get; set; } public int? ParentId { get; set; } [ForeignKey("ParentId")] public virtual Branch Parent { get; set; } public ICollection<Branch> Children { get; set; } // direct successors } In my application I have exactly one root branch. And except for this single root branch, every branch has exactly one parent (the

Calling Oracle stored procedure using Entity Framework with output parameter?

倖福魔咒の 提交于 2021-01-27 03:00:08
问题 I have a simple Oracle stored procedure that gets three parameters passed in, and has one output parameter: CREATE OR REPLACE PROCEDURE RA.RA_REGISTERASSET ( INPROJECTNAME IN VARCHAR2 ,INCOUNTRYCODE IN VARCHAR2 ,INLOCATION IN VARCHAR2 ,OUTASSETREGISTERED OUT VARCHAR2 ) AS BEGIN SELECT INPROJECTNAME || ', ' || INLOCATION || ', ' || INCOUNTRYCODE INTO OUTASSETREGISTERED FROM DUAL; END RA_REGISTERASSET; I am trying to use Entity Framework 6.1 to get back the OutAssetRegistered value, however, I