zzz projects Entity Framework 6 EF 6
Home EF Core Articles Knowledge Base Online Examples
  • Home
  • EF Core
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework 6 - Knowledge Base (KB)

6940 results

How can I insert a row in my database that has a foreign key without adding a row in the linked table?

I created an Entity Model with Database First on my project. In my database i have two table´s. One for books and one for the author´s. The books have a foreign key on the authortable. And every time I want to add a new book, im adding a new author, eve...
c# entity-framework-6 foreign-keys sql sql-insert
asked by Deltax

Make API call and database operations atomic

I want to do the following:...Begin a transaction...insert data to a database...After the insert, submits data to an API endpoint with the newly added rows' primary key...Then commit the transaction...If the insert fails, nothing will be done and everythi...
atomic c# entity-framework entity-framework-6 transactions
asked by morbidCode

Identity insert when adding many to many relations EF

i made a many to many relationship and the table was created with Classes and Users for a gym web app,but when i try to insert values to that table i get ...SqlException: Cannot insert explicit value for identity column in table 'classes' when IDENTITY_IN...
c# entity-framework entity-framework-6
asked by Turqay Umudzade

Exception while evaluating EntityState of a List object in Entity Framework Core

I am building a small logging application. In few scenarios, I am saving one ...TransactionHistory... object by evaluating the ...EntityState.... When a new object is added to ...DomainObject... (...TransactionHistory...), the entity state is changed to a...
.net asp.net-core c# entity-framework-6 entity-framework-core
asked by Vijay

Multiple where conditions on entity causes read only property to be true

I'm trying to filter the results from an entity, but when I put two where conditions before the load it'll only filter by the first condition like so ... _entity.LineItems.Where(x =>( x.EstID == Est.EstID) && (x.LineItemType == 1)).Load(); radL...
c# entity-framework-6 telerik-grid
asked by tomA

Can't access sql mdf file during google sync

I have an mdf file I access via ADO.NET entity framework. The file is in a folder that is synced by Google Drive desktop app....If Google Backup and Sync has accessed the file before, it doesn't even have to be currently syncing the file, then my program ...
ado.net c# entity-framework-6 sql-server
asked by James DePaola

Change in sql server location causes Event 1026 .Net Runtime

I am connecting an application to a different SQL Server database and find the following error in the windows event log...The only change is the database server ...Event 1026, .NET Runtime...Application: My.MyApp2.Win.exe Framework Version: v4.0.30319 Des...
entity-framework-6 sql-server xaf
asked by Kirsten Greed

EntityFramework 6.4 - add-migration broken

Using Visual Studio 2019 16.5.3, Microsoft .NET Framework 4.803752. Build target is .Net Framework 4.6.1. I did NuGet install of EntityFramework 6.4, also have Roslyn. Not using .NET EntityFramework Core (not sure that's the correct name -- something Core...
entity-framework-6
asked by Bob Koury

make a generic js file to be used across all views

So there is a script I wrote in each view to show notification status according to a specific result. I want to make it in a single js file and then just call it in each view. the problem is ...@TempData... can't be read in the js file or to be clear outs...
asp.net-mvc c# design-patterns entity-framework-6
asked by 2766

Entity Framework adds duplicate foreign keys

I have two entities...public class CandlestickData { [Key] public int Id { get; set; } public virtual Symbol Symbol { get; set; } [Column(TypeName = "datetime2")] public DateTime Time { get; set; } public decimal Open { get; set; }...
c# entity-framework-6 sql-server
asked by Stefan Scoarta

Relationship (database first) in Entity Framework

I created a database, then applied dataase-first. Then it automatically imported the database to VS. Please tell me, when database-first automatically indicates relationship? Probably not, my data is not being imported. Could you tell me how to establish ...
c# entity-framework entity-framework-6 entity-framework-core relationship
asked by Кирилл Филободченко

How to map foreign key property to database in EF6 automatically

In my database I have two tables:...Scenario...:...Id Name Location_Id ...Locations...:...Id Name ...So ...Scenario... has a foreign key to ...Locations.......In the code I have this:...Scenario.cs:...public int Id { get; set; } public string Name { get; ...
c# entity-framework entity-framework-6
asked by Martijn

Can't execute Query in EF6.3

I have the following query:...var result = await _dbContext.ApplicationItems.ToListAsync(); ...At runtime I get an exception on that query line:...I don't know why this exception is happening....The class ApplicationItem looks like this:...public class Ap...
.net entity-framework-6 exception
asked by Luka

How to auto increment Id with VARCHAR or NVARCHAR in Entity Framework Core?

I used to do that using a compound column in my SQL code before....[ID] [int] IDENTITY(1,1) NOT NULL, [PreFix] [varchar](50) NOT NULL, [EmployeeNo] AS ([PreFix]+ RIGHT('0000000' + CAST(Id AS VARCHAR(7)), 7)) PERSISTED,
asp.net asp.net-core entity-framework entity-framework-6
asked by Jawed Khalil

How to convert sql query to entity framework core

I want to convert sql query to entity framework core. SQL query is...select * from Departments where id in(select DepartmentId from SubDepartments where id in(select SubDeptId from Tests where id in(select TestId from PatientTests where PatientId=3)))
entity-framework entity-framework-6 entity-framework-core
asked by SK jha

Case insensitive name of tables and properties in Entity Framework 6

I am in the process of migrating the database from SQL to postgres. The application code is using Entity framework 6. I am facing issues with case sensitivity as postgres stores table, column names in lower case unless using double quotes....The data pres...
entity-framework entity-framework-6 npgsql
asked by user13332671

Entity Framework migrations: can't convert a property to a NotMapped runtime getter

I have this in a DAL:...public bool MyProp { get; set; } ...My intention is to remove that property from the db, and calculate it at runtime instead, so I've modified it like this:...[NotMapped] public bool MyProp => Smthng > Something.Else; ...However, w...
.net entity-framework-6 visual-studio-2019
asked by lhpcw

Entityframework - Include nested children from parent

I'm trying to load two children from a nested parent....dbContext. .Where(f => f.Id == Tenant.Id) .Include(f => f.Users .Select(x=>x.Nicknames) .Select(x => x.FavoriteMovies)) .SingleOrDefault(); ...So above I have a Tenant which has many users. Each user...
entity-framework entity-framework-6 linq-to-entities
asked by MindGame

How to check if a delete operation succeeds in ASP.NET MVC using Entity Framework

Is there a way to determine if an entity record gets deleted successfully? Please see code and comments below....var myProductID = 123; var productToDelete = await db.Products.Where(p => p.ID == myProductID).FirstOrDefaultAsync(); if (productToDelete !=...
.net asp.net asp.net-mvc c# entity-framework-6
asked by AndyDev0918

handle Entity Framework migration when live and development Database is same

I am using entity framework 6 with code first approach. I use the same database for live & development purpose, when I make change in model or add new fields in the model, then add-migration and run update-database, migration add and update successfully l...
asp.net-mvc c# entity-framework-6 entity-framework-migrations
asked by hashimkayani

Page 347 of 347
  • ««
  • «
  • …
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!