Questions tagged [dbset]
224 questions
0
votes
1 answer
ASP.NET DbSet Join
I have two classes, client and user. User is a field in client (there is a foreign key). I am trying to do a join, getting all the clients and the related user (it is one to one).
I am using Entity Framework and a web service that gives me my…

Meir
- 1,943
- 5
- 22
- 38
0
votes
1 answer
How do I get DbSets in an Android application from an MVC internet application?
I am developing a C# MVC4 internet application and would like to get the data from this database and use this data in my Xamarin application.
Here is my MVC Context class:
public class DatabaseContext : DbContext
{
public DbSet…

Garry
- 1,251
- 9
- 25
- 45
0
votes
1 answer
Querying dbset using collection of IDs - how to use .Any()?
I have this query:
var qClaims = from c in CasaLatinaEntities.tblClaims
where c.PersonID == PersonID
select c;
var qClaimStatus = CasaLatinaEntities.lnktblClaimStatusClaims
.Where(cs => cs.ClaimID ==…

nick gowdy
- 6,191
- 25
- 88
- 157
0
votes
1 answer
Add and remove operations doesn't work in entity framework
I was doing some tests about repository pattern applied to Entity Framework, when a problem comes out. I have implemented (via code-first) a core-layer and data-layer of an imaginary hotel manager software (called HotelManager) that i'd like to use…

GiveEmTheBoot
- 534
- 9
- 24
0
votes
1 answer
How can I detect changes IDbSet
I am creating a mock IDbSet to allow unit testing of entity framework classes, amongst other things.
However I am really having trouble detecting changes, or even figuring out how to do it at all. Here are my classes so far...
public interface…

Nick Williams
- 1,237
- 6
- 19
- 40
0
votes
1 answer
Creating generic DbSets based on entity types
In EF code first using following peace of code, I could create non-generic DbSets based on each entity type:
foreach (var entry in _dbContext.ChangeTracker.Entries())
{
BaseEntity entity = entry.Entity;
Type type =…

Masoud
- 8,020
- 12
- 62
- 123
0
votes
0 answers
Add not inserting/working
I have an AccountRegister model that i make into an Account model and then add that Account model to the database. There is zero errors/exceptions when i click the create button, it just redirects to index as if it has inserted into the database,…

DrexxDK
- 16
- 3
0
votes
1 answer
How to Enforce EF to update only one column in the Db in this example?
What I want to achieve is to only UPDATE particular property of an entity in the Db.
(To mimic something like UPDATE Foo Set Status = 'kool' WHERE ID = 99).
I try this:
public void SetFooStatus(Foo foo)
{
var…

pencilCake
- 51,323
- 85
- 226
- 363
0
votes
2 answers
How to query multiple DbSets in a single LINQ statement
I am going through some trouble with EF.
In this model I would like to get an IEnumerable of all Products whose names match some string, but also the Products inside an Order whose name ALSO matches the same string, all of this without Product…

Ozplc
- 1,091
- 2
- 10
- 15
0
votes
3 answers
DBSet how to multiple update?
I am facing a problem when try to update records via using dbset.
The following is my code:
CROPContext db = new CROPContext();
var EPins = from EPin in db.Pins.Take(5)
where
(EPin.UserID == null && EPin.CC == 5000)
…

DragonZelda
- 168
- 1
- 2
- 12
0
votes
1 answer
Paging with DbSet<>.Local
I'm trying to page a data set in a WPF application.
My service method looks like this:
public ObservableCollection GetPageOfModels(int projectId, int numSkip, int numResults)
{
this.db.Set()
.Where(x => x.Project.Id ==…

Cocowalla
- 13,822
- 6
- 66
- 112
0
votes
2 answers
using the dbset of Inherited class
Lets say I have a class Foods
public class FoodsContext : DbContext, IUnitOfWork
{
public DbSet Consumers {get; set;}
}
and there is class Fruits
public class FruitsContext: FoodsContext
{
public DbSet Prices {get;…

Cybercop
- 8,475
- 21
- 75
- 135
0
votes
2 answers
Code first not putting Dictionary property of class into database, ASP.NET MVC4
I'm building my first biggish web app in ASP.NET MVC using Code First migrations. Every other class is being updated in the database whenever I alter it, but not this class. The UserID and Wallet are being saved, but the Dictionary is always null…

Josh Dean
- 1,593
- 2
- 11
- 17
0
votes
0 answers
LINQ where clause not returning results
Result set returns empty and i'm getting that error 'Enumeration yielded no results' when i use Where clause(LINQ) . What could be problem?
public class Stores
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int StoreId {…

user2282567
- 781
- 1
- 7
- 14
0
votes
2 answers
DbSet, IQueryable - OOP concepts
public interface IDepartmentDataSource
{
IQueryable Departments { get; }
}
public class DepartmentDb : DbContext, IDepartmentDataSource
{
//Error: property cannot implement property....
public DbSet Departments…

mishap
- 8,176
- 14
- 61
- 92