Questions tagged [ef-model-first]

231 questions
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…
0
votes
2 answers

Pass null datetime using EF model-first

I use EF model-first in my application and use stored procedures too. My table has a LastStatus column name of datetime datatype and it's nullable. When the user fills in a datetime value, it works correctly. Here is my code : (@StartAcceptDate IS…
user9390243
0
votes
1 answer

Entity Framework model first: create UNIQUE constraint programmatically

I am trying to add a UNIQUE constraint to the "Username" property of my "UserAccount" entity/class. With code-first, that would be no problem, but for model-first, I can't find anything on how to achieve that. The designer does not support this…
Cleo
  • 620
  • 2
  • 10
  • 32
0
votes
1 answer

Entity Framework Type and Properties not mapping ( errors 11007 and 11009 )

I'm having trouble with model first in entity framework 6, .net 4.7, visual studio 2017... I'm trying to add a many to 0...1 with foreign key between two tables and when I try to validate the model I get an error saying the foreign key field in the…
0
votes
0 answers

How to create a tree structure data in SQL Server using ASP.NET MVC Model fist

I need to save a Tree Structure Data into my database. At first, I used XML as a attribute to perform this use case, but then I met some concurrency issues. Now I decide to use table relationship to perform a tree structure, but still met some…
0
votes
0 answers

How to update Datebase from edmx Model first?

I have made a Entityframework model first to create tables to the database, but then I found mistakes in my design, so I change the edmx model manually, including changing the constraints between relationship as well as multiplicities. So now,…
OOD Waterball
  • 707
  • 1
  • 11
  • 31
0
votes
0 answers

How to have an Entity Framework (EF6) dynamic association to latest entry?

I have this table/entity scenario in my model-first EF project (simplified): Machine: ID (primary key) GroupId (string) ActiveConfiguration (of type Configuration) Configuration: ID (primary key) GroupId (string) ValidFrom (date) Now…
SmartK8
  • 2,616
  • 1
  • 29
  • 37
0
votes
1 answer

Why is this Entity Framework crash sometimes happening in my WPF app?

I manage a publicly available WPF app which uses Entity Framework 6.1 (model-first ObjectContext) and a SQLite database. The number one crash log (according to HockeyApp) for my app is the following (with pointers to my app's code marked…
Ross
  • 4,460
  • 2
  • 32
  • 59
0
votes
1 answer

AllowHtml does not work with model first - "potentially dangerous request"

I am using MVC with model first. I used [ValidateInput(false)] on my controller which accepts a rich text input. This worked fine. Now I found the following post which allows me to use [AllowHtml] which I would prefer…
Coolkau
  • 128
  • 1
  • 8
0
votes
1 answer

Disabling migrations

I'm writing a web api attached to a database that I created using Model First. Being new I was confusing Model First with Code First. As it's my first EF/Web app I didn't realize that migration wasn't yet implemented by Model First and I followed…
0
votes
1 answer

Moving from EF-Model First to Code First

I'm extremely new to programming. Just above school level. I created a project using EF Model First only to realize after I cannot get it to use SimpleMembership for Login, etc. I wanted to try and solve this problem whilst remaining model-first as…
0
votes
1 answer

EF Model First: how to programmatically generate/delete database?

In the EF tutorials described the work with Model-First approach in the following way: create the model generate database sql from model launch generated sql via studio But how it could be delivered to the customers? The database must be created…
AeroSun
  • 2,401
  • 2
  • 23
  • 46
0
votes
2 answers

Get Entity Framework Model first Entity Name dynamic

I want to do something like this : Get Column name of an Entity in Entity Framework. I don't want directly using Entity Name , I want to pass Entity-Name to method as string. public HttpResponseMessage GetColumnName(string MyClassName) { var…
Eqbal Sohrabi
  • 826
  • 6
  • 23
0
votes
1 answer

How to add Create and Edit View to Model with IEnuernation properties?

let's say I use Entity Framework 6 and have the following two tables in a model-first approach: This creates following code: My question is now, how do I use the IEnumeration properties in a Create View? In a Details or Delete View, I just…
LeonidasFett
  • 3,052
  • 4
  • 46
  • 76
0
votes
1 answer

Cannot generate sql in entity framework for oracle database

I am trying to generate oracle sql for my entity framework model. I can generate the SQLServer sql fine, the error only occurs with oracle generation. I've installed the oracle developer tools for VS fine. I have selected "Generate Oracle Via T4…
Brad Zacher
  • 2,915
  • 18
  • 31