Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
60 views

I have seen countless posts advising that EF Core with SQL Server blocks multiple foreign keys which have "OnDelete Cascade" (due to cycles and multiple delete paths). However I see in the ...
victorswhisky's user avatar
0 votes
0 answers
38 views

I have the entity: public class UserQuestion { public Guid UserId { get; set; } public bool HasCompletedQuestion { get; set; } public Guid? QuestionInformationSetId { get; set; } ...
maxime's user avatar
  • 1
1 vote
1 answer
59 views

I have a Table called Command public class Command { public int Id { get; set; } public CommandParameterBaseEntity Parameter { get; set; } = null!; } and two (or more) other tables with ...
HWS-SLS's user avatar
  • 166
1 vote
1 answer
274 views

I have two entities CodeMaster and Employee. In Employee, I have more foreign key optional properties to navigate to the CodeMaster entity. When I insert data into Employee, I get this error: Inner ...
Ahasanul Banna's user avatar
0 votes
1 answer
584 views

Is there any way to represent something like this : public abstract class DbEntity { [Key] public string Id { get; set; } // <-- a GUID-String created by the domain } public class Carrier :...
Caaged's user avatar
  • 1
0 votes
0 answers
457 views

I have the following entities: public class CompanyRelationshipEntity { public int ParentCompanyId { get; set; } public int ChildCompanyId { get; set; } public CompanyEntity? ParentCompany ...
Mark Walsh's user avatar
  • 3,381
-2 votes
1 answer
88 views

I have two tables called employee and team. I want to set relationships among the tables as follows. employee belongs to a team. (1: m relationship). team has a team leader (team leader is also an ...
Nipuna Hettiwatta's user avatar
1 vote
2 answers
778 views

I have following Schema in EF Code First Architecture. Class Teacher public class Teacher { [Key] public int Teacher_PK { get; set; } public string Name { get; set; } public int Age { get; set; } ...
Maulik Dave's user avatar
0 votes
1 answer
1k views

I have a recommendation from Azure to create the following index: CREATE NONCLUSTERED INDEX [nci_wi_Transactions_71EA7D20388C3F47A9B9EBF2A1C7BA0C] ON [dbo].[Transactions] ([Client_Id]) INCLUDE ([Date],...
arteny's user avatar
  • 388
0 votes
1 answer
548 views

I might be looking at this the wrong way but I have a basic many-to-many code-first setup in EF Core 3.1 with Department <-> DepartmentDay <-> Day. modelBuilder.Entity<DepartmentDay>(...
Hyzac's user avatar
  • 537
1 vote
2 answers
1k views

This is my model class public class ImageModel { [Key] public int ImageId { get; set; } [Column(TypeName = "nvarchar(50)")] public string Title { get; set; } [Column(...
scorpion private's user avatar
0 votes
1 answer
34 views

I have a project where I need a complex relationship: public enum InputFileTypes { unknown = 0, ConfirmationFile = 1, PrestationFile = 2, EOCChoiceFile = 3, EOCReplaceFile = 4, ...
Luc Van den Borre's user avatar
0 votes
1 answer
273 views

I'm a little new to code-first in EF Core and I'm trying a few things out and I'm a little confused how to implement the below (or indeed whether it can be implemented or not). In my model I have a ...
Ian Boggs's user avatar
  • 542
0 votes
0 answers
442 views

I'm still new to the .NET especially ef core. I am having trouble defining the relationship between the entities using code first approach with existing database. I develop this using Visual Studio ...
wwdev's user avatar
  • 23
2 votes
0 answers
552 views

I am using Entity Framework Code First to design my database. I am wondered if there is a way to add extended property to my tables and columns using entity framework, so I can use my code docs in ...
mahmood's user avatar
  • 117
1 vote
1 answer
1k views

I have this a class Order, it has relation with other 2 classes but the issue is with the Id here public class Order { public int Id { get; set; } public bool IsDeleted { get; set; } ...
Zinov's user avatar
  • 4,169
0 votes
0 answers
221 views

I have a Asp.Net Core MVC 3.1 project. I want to join appointment and patient tables with code first technique however the foreign key column is null. My Patient Class; public class Patient : ...
Ayşe Akışık's user avatar
0 votes
0 answers
134 views

I am using ASP Core Web Application, MVC, Code First, with MySQL db. Here is the structure of my db: Here is code for those 2 models/classes: =====This code is for 2nd EmployeeDate Table (Child)===== ...
AlecTech's user avatar
-1 votes
1 answer
903 views

I am working in dotnet core web api using restful service with entity framework code first approach. I am running one migration and when I run the migration using add-migration command then I get ...
Rahul's user avatar
  • 166
4 votes
1 answer
2k views

I'm using code-first with EF Core 3.1.2 I have established the following two-way one-to-one relationship in the OnModelCreating method of my DbContext. modelBuilder.Entity<Inspection>() ....
tassieboy's user avatar
  • 160
1 vote
1 answer
1k views

I am new to Entity Framework Core. In my shopping cart models design, I have a little confusion in designing my model classes using Entity Framework Core. I have assign collection of address to user ...
newbie_developer's user avatar
2 votes
1 answer
232 views

I'm trying to scaffold out a razor page set for my Ticket class and I'm getting an error when Entity Framework tries to create the database: My understanding is that if you have a property "Id" it ...
VergilPrime's user avatar
1 vote
0 answers
977 views

I want to create a migration for creating a new table in my database but after executing the Add-Migration MsSql_Add_ArticleCategory_Table, I got this error: No mapping to a relational type can be ...
x19's user avatar
  • 8,913
0 votes
1 answer
155 views

I have three classes public class Country { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public byte CountryID { get; set; } public byte OfficialLangID { get; set;...
Shadi Fayed's user avatar
0 votes
1 answer
165 views

For some time I've been following the "First Class Collections" rule from Object Calisthenics in my domain design. In order to avoid creating a useless "Collection" table though, I use the table ...
Marcos Dimitrio's user avatar
0 votes
2 answers
884 views

I have the following class that I want to use as my data context in Entity Framework: public class AggregateRecord : IAggregateRecord { [Key] public int AggregateRecordID { ...
ck84vi's user avatar
  • 1,586
0 votes
1 answer
1k views

I have a number of inheritance hierarchies in my model. I'm using Entity Framework Core 3.1.2 with a Postgres database. Code First. I am trying to create a migration to generate my database tables. I ...
tassieboy's user avatar
  • 160
1 vote
1 answer
849 views

I have the following model classes: public class Farmer { public int ID { get; set; } public Box Box { get; set; } } public class Apple { public int BoxID { get; set; } public Box ...
fomi's user avatar
  • 159
2 votes
0 answers
314 views

I would like to generate a document from the Entity Framework code-first context class. The documentation would generate an object reference model and how it is mapped to the database. How would one ...
David Good's user avatar
0 votes
2 answers
483 views

I want to create below two tables using Entity Framework 6 code first approach. I can use attribute notation or fluent API or combination of both. Mainly I want to know how to create the mappings ...
Shubho's user avatar
  • 155
0 votes
0 answers
67 views

**public class Ticket : BaseEntity { public TicketType TicketType { get; set; } } public class TicketType : AuxiliaryInfoBaseEntity { public string Description ...
mohan chichila's user avatar
0 votes
1 answer
280 views

Hi i have a model class like public class Individual : EntityBase { public Individual() { RelatedIndividuals = new HashSet<RelatedIndividual>(); } public string ...
lukacecxladze's user avatar
1 vote
0 answers
367 views

I'm using Entity Framework Core 2.2 code first. Soft delete is implemented in the overriden Context class. There is an UnitOfWork class that initializes Repositories for specific entities, while ...
Armino's user avatar
  • 151
3 votes
2 answers
773 views

Hi all i have model sections like this below public class Sections { public int SectionId { get; set; } public string Name { get; set; } public string Description { get; set; } ...
Glory Raj's user avatar
  • 17.7k
0 votes
1 answer
329 views

Why NpgsqlEntityTypeBuilderExtensions and NpgsqlPropertyBuilderExtensions has ForNpgsqlHasComment method to set Comment, but NpgsqlIndexBuilderExtensions doesn't. How to set Comment for Index in ...
Michael Mankiewicz's user avatar
0 votes
1 answer
261 views

Using EF 6 and "Code First from database" it generates a "OnModelCreating" that is 20k lines approximately 688k of code against our large (650+ tables) database. This causes IIS to append as it is ...
CmdrTallen's user avatar
  • 2,282
1 vote
1 answer
911 views

I have two database tables -- Customer_Values and Customer_Attributes... and it's... dumb. Terrible. Customer_Values has things like CustomerId | AttributeId | Value --------------------------------...
Dave Matney's user avatar
3 votes
1 answer
4k views

I have a one to one relationship set up on ef core. When i try to delete Article entity I need to cascade MediPlan since it is one to one relationship. When I Delete Article, MediaPlan is not getting ...
kkdeveloper7's user avatar
1 vote
0 answers
220 views

I have the following models: class Item { public ICollection<string> GroupIds { get; set; } // Introduced for EF only public ICollection<Group> Groups { get; set; } } class ...
Aleksandr Vishnyakov's user avatar
1 vote
2 answers
1k views

Stored procedure works and deletes what I want but I still get this error after deleting: The data reader is incompatible with the specified 'AMSIdentity.Models.RemoveRoleFromUserViewModel'. A ...
ali's user avatar
  • 384
1 vote
1 answer
1k views

I have a more complicated question here But thought I would simplify it. Here are my dummied classes (the structure this is based on comes from the NDC so I don't have control over it): public class ...
Gina Marano's user avatar
  • 1,833
2 votes
3 answers
10k views

I'm trying to add data to the database using EF Core, but I cannot overcome duplicate key error: Cannot insert duplicate key row in object 'dbo.Stocks' with unique index 'IX_Stocks_Name'. The ...
Łukasz Sypniewski's user avatar
0 votes
1 answer
833 views

I am creating a Web API application using EF with a code-first approach in Visual Studio 2017. I tried to use enable-migration, initially I was not working so I installed these packages. Install-...
Bhushan Khaladkar's user avatar
0 votes
2 answers
212 views

How do I map join table data to a model in the code first approach with entity? I'd like to fetch the user info belonging to the chat message when i fetch chat messages. I'm getting the error ...
Stevie Wonder's user avatar
0 votes
3 answers
2k views

class UserLogin { [Key] public int id { get; set; } [StringLength(50)] public string userName { get; set; } [StringLength(20)] public string password { get; set; } ...
Rakib13's user avatar
  • 106
0 votes
1 answer
38 views

I have a shopping cart that is to receive items from two separate tables. One table contains single items and the other contains Boxes of several items. I am using an ApiController to insert the ...
DarrenB's user avatar
  • 75
1 vote
1 answer
1k views

All Positions have a Location (Many-to-1). Different Location types have different Position types Model: public abstract class Location { public int Id { get; set; } public string Name { ...
JMH's user avatar
  • 13
0 votes
1 answer
518 views

I am getting this error in code first MVC CORE while inserting this and I am doing Code first for very first Time command: Update-Database -Context ProjectDbContext "Introducing FOREIGN KEY ...
Syed M Usama's user avatar
0 votes
1 answer
610 views

i am trying to make relation "Student has many StudentRecords" using repository pattern. when i run migration facing below error.Kindly let me know what should i do in on model Creating method. "The ...
sameer Ahmed's user avatar
3 votes
2 answers
5k views

i'm working with EF6 code first, and i used this answer to map a List<stirng> in my entitie. This is my class [Key] public string SubRubro { get; set; } [Column] ...
Juan Salvador Portugal's user avatar