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)

16 results in tag: dbset

DbSet.Find method ridiculously slow compared to .SingleOrDefault on ID

I have the following code (Database is SQL Server Compact 4.0):...Dim competitor=context.Competitors.Find(id) ...When I profile this the Find method takes 300+ms to retrieve the competitor from a table of just 60 records....When I change the code to:...Di...
dbcontext dbset ef-code-first entity-framework sql-server-ce-4
asked by Dabblernl

Does converting from DbSet to IEnumerable cause the query to execute?

I have the following 2 methods in my Logs repository. ...public IEnumerable<Log> GetAll() { var db = new CasLogEntities(); return db.Logs; } public DbSet<Log> GetAllSet() { var db = new CasLogEntities(); return db.Logs; } ...
dbset entity-framework
asked by David Kethel

Entity Framework dbset most efficient way of deleting

I have the following and looking for a more efficient way of deleting vs looping through the records and then deleting each one at a time (note using Dbset):... var wcd = dbContext.ProgramDetails.Where(p => p.Id == Id); foreach (var wc in wcd.T...
dbset entity-framework linq
asked by Nate Pet

Get all rows using entity framework dbset

I want to select all rows from a table using the following type of syntax:...public IQueryable<Company> GetCompanies() { return DbContext.Set<Company>() .// Select all } ...Forgive me as I am completely new to EF.
c# dbset entity-framework
asked by Wesley Skeen

Is DbSet<>.Local something to use with special care?

For a few days now, I have been struggling with retrieving my entities from a repository (...DbContext...). ...I am trying to save all the entities in an atomic action. Thus, different entities together represent something of value to me. If all the entit...
c# dbcontext dbset entity-framework
asked by bas

DbSet.Cast<TEntity>() Error: Cannot create a DbSet<IEntity> from a non-generic DbSet for objects of type 'Entity'

Version Info:...I am using C# 4.5, Entity Framework 6.0, and MEF....Code and Unit Test...I created a Test Project to explain the problem: ...https://skydrive.live.com/redir?resid=E3C97EC293A34048!2234...Please Open the UnitTest project and try to run Test...
c# casting dbset entity-framework mef
asked by Aidin

NSubstitute DbSet / IQueryable<T>

So EntityFramework 6 is a lot better testable then previous versions. And there are ...some nice examples... on the internet for frameworks like Moq, but the case is, I prefer using NSubstitute. I've got the "non-query" examples translated to work with th...
c# dbcontext dbset entity-framework nsubstitute
asked by s.meijer

Find a specified generic DbSet in a DbContext dynamically when I have an entity

I have following classes and ...DbContext...:...public class Order:BaseEntity { public Number {get; set;} } Product:BaseEntity; { public Name {get; set;} } public class Context : DbContext { .... public DbSet<Order> Orders { set; get; } ...
c# code-first dbset entity-framework generics
asked by Masoud

FakeItEasy DbSet / IQueryable<T> - Entity Framework 6

I was wondering if anyone had a similar example to this ...post... for FakeItEasy (original post is ...here.... I have been trying to find the correct setup, but could not get it right. I could not find any examples online. I am beginning to teach myself ...
dbcontext dbset entity-framework-6 fakeiteasy unit-testing
asked by jmzagorski

How does Entity framework implement deleting parent and a child record on the ame SaveChanges()

I have the following two entity sets representing Dept & Emp:-...public partial class Dept { public Dept() { this.Emps = new HashSet<Emp>(); } public int DeptID { get; set; } public string Name { get; set; } public string ...
dbset edmx entity-framework entity-framework-5 entity-framework-6
asked by john Gu

Dbset<TEntity>.Add(entity) assigns an ID and this results in a exception

For the following classes :...public Car { public int ID { get; set; } public string Brand {get; set; } } ...Normally when we do : ...Car c = new Car { Brand = "Jaguar" } ; // Point A context.Cars.Add(c); // Point B context.SaveChanges() // Point...
c# dbset entity-framework entity-framework-6
asked by tobiak777

Entity Framework - Database First - Invalid column name error

I have three simple classes and I am wiring up EF6 to an existing database....Classes are as follows...namespace Infrastructure.Models { [Table("Applications")] public class Application { [Key] [DatabaseGenerated(DatabaseGener...
database-first dbset entity-framework-6
asked by Solo812

Mocking DbSet<T> inline

I am using ....NET4.5..., ...EF6..., and ...Moq... for unit testing. I am trying to mock up some Db data for test. I have an example how to do this with declaring ...mockset as variable and then using mocks....public static class TestExtensionMethods { ...
c# dbset entity-framework-6 moq unit-testing
asked by Matas Vaitkevicius

Filtering non-generic DbSet with dynamically built Expression

Plot:...I have a class implemented as a facade around Entity Framework DB context. It developed to maintain backward compatibility, it mimics class with same public interface, but uses DTOs instead of EF entities....Problem:...I have next method inside cl...
dbset entity-framework expression-trees generics linq
asked by Andrey Weber

Member 'CurrentValues' cannot be called for the entity of type 'MyTable' because the entity does not exist in the context

I have a MVC application that used Entity Framework v6.0. Whenever a change is made to the ...DbContext..., I override the ...SaveChanges()... method and record the modifications in an audit log. Below is code for part of the audit log recording process:....
c# dbcontext dbset entity-framework entity-framework-6
asked by Tot Zam

EntityFramework 6 out of memory exception

Hej,...I have a table in database that holds compressed large size file....when I try to read that file via a ...Ef6.... It throws an out of memory exception....Any help would be appreciated....My code is like ...var payload = repositoryContext.Set<Docume...
dbset entity-framework-6
asked by user3661407

Page 1 of 1
  • 1

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!