Questions tagged [ef-model-builder]
58 questions
0
votes
1 answer
Double Relation One to Many (different Property same Class), Unable to determine the relationship represented by navigation, C#
I want to establish double relation using List between NxProperty custom class and NxLog custom class.
public class NxLog
{
public string NxLogId { get; set; }
public string NxWorkspaceId { get; set; }
public string NxConversationId {…
user5113188
0
votes
1 answer
Storing custom class property like String via OnModelCreating of DBContext .Net Core
I have two classes in .Net Core
The class Owner
namespace CustomStoreDatabase.Models
{
public class Owner
{
public string OwnerId { get; set; }
public DateTime MinDateTime { get; set; }
public DateTime MaxDateTime {…
user5113188
0
votes
1 answer
How can i configure model builder to delete all recipes when user is deleted but when recipe is deleted keep the user
This is my model builder right now, but when i delete user it sets recipes userid to null.
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
…

Kamil Górny
- 21
- 1
- 5
0
votes
1 answer
How can I get the EF Core model configuration entity property comment set in HasComment as the html title attribute
Trying to set the title attribute of an html element as the parameter passed to the entity.Property().HasComment(comment) method.
I've tried with no luck:

Leo
- 1
- 1
0
votes
0 answers
How do I remedy "cycles or multiple cascade paths"?
I have three entities:
ApplicationUser:
public class ApplicationUser : IdentityUser
{
// more properties
public List MeetingNotifications { get; set; }
}
MeetingNotifications:
public class MeetingNotification
{
…

Stian
- 1,522
- 2
- 22
- 52
0
votes
1 answer
TableName (Contains / Regex) When Creating An Entity - Entity Framework - Table Prefix
I'm trying to create an EF model based on an existing MySQL Database.
Upon creating an entity, I map it using:
[Table("databaseName.tableName")] or :
modelBuilder.Entity().ToTable("tableName") in OnModelCreating.
The issue I have is that the…

alozzi
- 53
- 4
0
votes
0 answers
EntityFramework Core - Related Entities without specific foreign key
thanks for taking the time to look over my question.
I am trying to get some data along with the related records from a database using a DbContext.
I already have an example of this setup for one of my relationships -
protected override void…

Rob Jeffrey
- 124
- 12
0
votes
1 answer
Enitity Framework Each property name in a type must be unique
I have the following entities defined and the relationship mapping also. However, while saving i get the error Name: Each property name in a type must be unique. Property name 'ResponseId' is already defined. in EF…

Developer
- 487
- 9
- 28
0
votes
2 answers
EF-Model for many-to-many Junction Table
I'm trying to straighten out the EF-Model for a junctiontable OwnerCows.dbo.
There's a class Cow with an Id, a class Owner with an Id and i want to reference them both in a OwnerCows-table that has only an OwnerCowId, a CowId(FK) and a…

BHANG
- 354
- 1
- 5
- 16
0
votes
1 answer
Persistance datalayer in EF core ,dynamic EF. Separate EF from models
I want to separate EF layer from my model .
I need a EF Builder to send my model to it like this(I found this code for mongodb but i need for EF core) :
builder.AddMongo();
builder.AddMongoRepository("Carts");
…

Ehsan Akbar
- 6,977
- 19
- 96
- 180
0
votes
2 answers
How to DeserializeObject from json where data model exist in Entity Framework?
I have an incoming json object that represents the data pulled from a database structure.
I would like to map it to the Entity Framework model which has the definitions either from attributes or from model builder in the DB context.
When running…

Demodave
- 6,242
- 6
- 43
- 58
0
votes
1 answer
Unable to find the code generated by Fluent API model builder mapping in the Database Context
I am working with ASP.NET MVC 5 with Entity Framework 6.
I adjusted my achiteture by moving my models to a separate data project in an attempt to follow Clean Architecture.
Normally when I have all the models in the same project and the database…

sagooding
- 182
- 1
- 1
- 9
0
votes
1 answer
I want to add multiple roles at the time of registration with many to many relationship using EF Models
I have user registration table with roles, i want to register new user with multiple roles via Many-to-Many Ef Models Generated Models.
I have issue while registering users, New Roles are inserted into roles table and than these newly added roles…

Ramzan
- 15
- 6
0
votes
2 answers
I want to Add multiple Roles at the time of registeration with many to many relationship using EF Models in MVC
I have user registration table with roles, i want to register new user with multiple roles via Many-to-Many Ef Models Generated Models.
I have issue while registering users, New Roles are inserted into roles table and than these newly added roles…

Ramzan
- 15
- 6
0
votes
1 answer
Delete List of entities of the same entity on update
Hello everyone I can't find a solution to this problem, I have an Entity that have a property created like this on DbModelBuilder
First a class with a property RelatedFoo which is a list to the same Foo Entity
public class Foo
{
public…

BeN
- 55
- 9