45 questions
0
votes
1
answer
57
views
Deleting an UnAttached entry from dbContext cause exception when using GraphDiff
I'm using GraphDiff library in my c# project to update a disconnected graph. My Document entity has a one-to-many relationship with DocumentRelationShip entity as ToDocumentRelationship navigation ...
1
vote
0
answers
39
views
UpdateGraph updating associated collection property with parent node
After using UpdateGraph, if an associated collection has an attribute from the same class as the parent node, this attribute ends up being updated with a reference to the parent node.
The scenario is:
...
4
votes
1
answer
186
views
How to Delete Orphaned Records
I'm trying to use GraphDiff and Entity Framework to update a set of records across multiple tables. Everything works except I need to delete the orphaned record for any of the owned entities that may ...
0
votes
1
answer
47
views
Conditional mapping using GraphDiff
I am having an issue with GraphDiff whilst saving some data and I just need some one to confirm if this is possible.
I will provide an example of what is going on:
Firstly, I am using VS2017 (latest ...
0
votes
1
answer
106
views
How to update self-reference graph using GraphDiff?
I am using GraphDiff to update entity framework graphs and when I am trying to update self-referenced graph like this way:
dbContext.UpdateGraph(updatedStorageRequest, storageRequestMap => ...
3
votes
0
answers
134
views
UpdateGraph from GraphDiff raises an incomplete DbUpdateConcurrencyException
I am using EF6 and GraphDiff 2.0.1.
I want to check for DbUpdateConcurrencyException when I save an outdated entry.
When I do this without an UpdateGraph: no problem, EF raises the exception.
try
{
...
1
vote
0
answers
73
views
GraphDiff: rearrange children in a object hierarchy and save updated details
I use GraphDiff to save detached object hierarchy which represent the following data model,
project -> course -> module -> topic.
Problem is when I try to reorder the object hierarchy from,
...
0
votes
0
answers
195
views
Concurrency with GraphDiff when adding different child objects to owned collection
to make things not too complex, I will not take my own entity model for this question but the one from the original GraphDiff-Blog-Post here where there is a company entity that has multiple contacts. ...
1
vote
1
answer
452
views
Delete Owned Entities 2 level depth using GraphDiff
I am using Entity Framework code first (version 6) and GraphDiff in my MVC project.
here is some entities which map some tables in database.
public class CommunicationPlan
{
public int ...
1
vote
3
answers
447
views
The relationship could not be changed because one or more of the foreign-key properties is non-nullable on saving
I use GraphDiff to update detached object graphs, and I'm getting the above exception when saving a parent and its children.
The models and mapping are:
public class Group
{
public int Id { get; ...
1
vote
1
answer
664
views
When to disable proxy generation and use AsNoTracking?
In my WebApi project, I use EF6, follow Uow and generic repository patterns, and I also map my models to dto's and vice-versa.
Currently I set the following when creating the dbContext:
this....
30
votes
1
answer
17k
views
The relationship could not be changed because one or more of the foreign-key properties is non nullable
I get following error during update with EF:
The operation failed: The relationship could not be changed because one or more of the foreign-key properties is non-nullable. When a change is made to a ...
35
votes
2
answers
997
views
Conditional mapping with graphdiff
I have following entities in my DbContext:
public class A
{
public A()
{
Bs = new List<B>();
}
public ICollection<B> Bs { set; get; }
}
Sometimes I Want to update a ...
0
votes
0
answers
268
views
GraphDiff: "Cascading" Owned Collections
I'm trying to use GraphDiff (latest available version in NuGet) to handle what I consider a not terribly difficult entity model. Consider a model like so:
class A
{
public virtual ICollection<...
1
vote
1
answer
531
views
GraphDiff causing id of entity to not get populated after saveChanges()
When using graphDiff for creating a record the new id isn't getting populated back into the entity after saveChanges() is called. Its been logged on the github repo here - https://github.com/...
2
votes
1
answer
1k
views
Resolving class that has extension methods with AutoFac
I am using a third party library GraphDiff which adds Extension methods to DBContext class. My Context class is inherited from Interface like following
MyContext: DbContext,IMyContext
IoC ...
1
vote
1
answer
485
views
Using Moq with EntityFramework graphdiff
I have just added GraphDiff in an existing Entity Framework solution which is utilizing Moq framework for testing.
All my tests that are using Moq in insert and update methods are now failing since ...
4
votes
1
answer
368
views
How to ignore property using graphdiff?
I'm using EF6 with graphdiff and EDMX and must ignore a property of a particular entity.
How should I do since even getting the property the insert or update always leave the NULL field?
0
votes
0
answers
71
views
Entity Framework not updating one-to-one entities
I have these models:
public class Address
{
public int Id {get; set;}
public string Street {get; set;}
public string HouseNo {get; set;}
}
public class Customer
{
public int Id {get; ...
7
votes
1
answer
5k
views
How to update related entities using GraphDiff?
I have the following model:
public class Customer
{
public int Id {get; set;}
public string Name {get; set;}
public int AddressId {get; set;}
public virtual Address Address {get; set;}...
0
votes
1
answer
190
views
Should foreign Id properties be mapped from Model to Dto?
If I have the following model:
public class Customer
{
public int Id {get; set;}
public int CustomerTypeId {get; set;}
public virtual CustomerType {get; set;}
}
Should the Dto exclude ...
2
votes
1
answer
427
views
Can GraphDiff be used for partial updates of simple entities too?
I have a WebApi2 project with EF6 CodeFirst. I'm also using AutoMapper to map between my models and dto's. I'm not using OData.
I'm trying to find a solution to handle updates of entities. As I'm ...
2
votes
1
answer
325
views
Inserting entity doesn't update Key field
I'm trying to insert a detached entity into database using GraphDiff.
It goes something like :
public IHttpActionResult Post([FromBody] Foo foo) {
var newFoo = fooBusiness.AddObject(foo);
if ...
4
votes
1
answer
348
views
Empty rows insertion in Many-to-One and Many-to-Many relationships in GraphDiff
I am using GraphDiff, along with the latest version of the Entity Framework, following the code-first approach.
I am trying to update a Food entity this way:
public void Update(Food food)
{
...
0
votes
0
answers
205
views
How to update an entity with a collection of abstract types by using GraphDiff?
I have some models:
public class RootEntity
{
public int Id {get; set;}
public virtual ICollection<AbstractEntity> CollectionA {get; set;}
}
public abstract class AbstractEntity
{
...
1
vote
1
answer
376
views
Optimize GraphDiff performance on first update (subsequent updates are quick)
I am working on a project with a very complex entity. The object graph contains approximately 30 objects in a tree with two levels (there are children of children).
The entity is managed in a browser,...
1
vote
0
answers
363
views
GraphDiff duplicate returned entities
I am using GraphDiff to update complicate object graphs. My main entity has multiple children that may be created, updated or deleted (OwnedCollections in graphDiff). So in GraphDiff when an entity ...
3
votes
1
answer
1k
views
Updating data in two related tables using GraphDiff
I have two tables, Order and OrderItems
The Order table has a OrderId column that's the primary key
The OrderItems also has this column as foriegn key.
For a given Order, if the OrderId is 1 and it ...
1
vote
1
answer
473
views
Setting association to foreign key to inherited object using graphdiff and Entity Framework
I have a issue with updating value on a foreign key which is inheriting from another class. I am working with detached object in Entity Framework, so I'm using graphdiff to handle it.
I've simplified ...
1
vote
1
answer
393
views
UpdateGraph with self referencing entity
I'm using GraphDiff with EF to update state of disconnected objects acquired from a REST Service.
It's working rather well from now but I got a problem with self referencing entities.
Entities :
...
1
vote
1
answer
83
views
Using GraphDiff on three tables
I have three tables
ShippingZone
ShippingZoneID -> PK
ZoneShippingMethod:
ZoneShippingMethodID -> PK
ShippingZoneID -> FK
ZoneShippingMethodRange
ZoneShippingMethodID -> ...
1
vote
1
answer
788
views
Graphdiff is removing entities
I have the following entities:
public class Profile
{
[Required]
public string Name { get; set; }
[Required]
public string Description { get; set; }
[Key, DatabaseGenerated(...
1
vote
1
answer
144
views
How do I combine two expression tree bodies?
If I have:
m => m.OwnedCollection(p => p.Addresses)
and
m => m.OwnedCollection(p => p.Contacts)
I'd like to combine them to be:
m => m.OwnedCollection(p => p.Addresses)....
3
votes
2
answers
1k
views
Updating a many-to-many relation using GraphDiff cause an error
I'm using EF code first 6.1 with .NET 4 in my application and have following classes in my model(I cut other unrelated parts of diagram. e.g Permission has other navigations):
My business logic works ...
2
votes
1
answer
379
views
GraphDiff and EF6.1 – Recursive Many-to-Many Relationship
I am having an issue with GraphDiff attaching an object which has a recursive many-to-many relationship. I am using GraphDiff 2.0.1 and Entity Framework 6.1.1.
The progam manages Recipes which can ...
1
vote
0
answers
2k
views
Updating Graph with One-to-One relation
I have a class Ricevuta which holds a collection of VoceRicevuta:
public partial class Ricevuta : GestPreBaseBusinessObject
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public ...
2
votes
0
answers
262
views
How can I prevent GraphDiff from removing missing children in the object graph?
I'm currently working on a project that requires we be able to pull up the exact state of an object and associated children at an point in time. To do this we've come up with a model similar to this:
...
1
vote
2
answers
276
views
How do you perform service-oriented parent-child transactions?
Example:
A SalesOrder is composed of a SalesOrderHeader and one or more SalesOrderItems. When editing an existing SalesOrder, the SalesOrderHeader can be modified and SalesOrderItems can be added,...
3
votes
1
answer
901
views
Update entity graph Ids with Db generated Ids in Disconnected environment(EF)
I'm working with EF6 code first in a WinForm project.
I used following method for reading entities from Db, updating them and then save back them to Db:
Read Entity graph using Linq to entities(after ...
5
votes
1
answer
177
views
Casting an expression to another one
I have following expression
Expression<Func<T, object>> expr1;
Is there any way to cast it to
Expression<Func<IUpdateConfiguration<T>, object>>?
[Update]
Or create ...
3
votes
1
answer
3k
views
Update Many-to-Many Association with GraphDiff
I have the following data model:
My business logic works with detached entities so I'm using GraphDiff to perform updates. I'm having trouble updating the PerfModes/CalcPoints association. ...
1
vote
0
answers
160
views
Does GraphDiff work in a database first scenario?
I'm using Entity Framework in an application with a existing SQL Server db. Can GraphDiff be used in a database first scenario, assuming I use the POCO Entity Generator?
2
votes
1
answer
3k
views
How to update an expression tree with GraphDiff
The object graph I'm working with is basically:
public class Resource
{
public string Forename { get; set; }
public string Surname { get; set; }
public int EmployeeNumber {...
2
votes
2
answers
3k
views
Disconnected Complex Graph With Disconnected Child Entities
I have a complex graph with a collection child entities.The relationship between parent and child entities is one-many relationship and has an Independent association. I know that I cant persist my ...
3
votes
1
answer
2k
views
Exception in Expression Trees
This is my model:
- Business
- BusinesType - FK
- Categories (*) - FK
- Branch (*)
- BranchType - FK
- Address
- Phone (*)
- CustomFields (*)
- OpeningTimes (*)
...