Top "Dbset" questions

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> …

c# entity-framework dbset
Create a DbSet<T> dynamically in Entity Framework?

In LINQ to SQL, I can create a repository dynamically using DataContext.GetTable<T>. Is there a similar …

c# linq-to-sql entity-framework-4 ef-code-first dbset
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;} } …

c# entity-framework generics code-first dbset
How to add an item to a Mock DbSet (using Moq)

I'm trying to set up a mock DbSet for testing purposes. I used the tutorial here, http://www.loganfranken.com/…

c# linq moq dbset
ASP.MVC db Find(), but with non-primary key parameter

How does one get a list of results by using a key that is not the primary key? To be …

asp.net-mvc database find composite-primary-key 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 …

entity-framework ef-code-first dbcontext sql-server-ce-4 dbset
X is a variable but used like a type when trying to cast

I am passing a string of the name of the entity type I want to query and getting the type …

c# reflection types dbset
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 …

c# entity-framework dbcontext nsubstitute dbset
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 …

linq entity-framework dbset
Can you get the DbContext from a DbSet?

In my application it is sometimes necessary to save 10,000 or more rows to the database in one operation. I've found …

c# entity-framework entity-framework-4.1 dbcontext dbset