Questions tagged [graphdiff]

GraphDiff provides DbContext extension methods for Entity Framework Code First, that allow you to save an entire detached Model/Entity, with child Entities and Lists, to the database without writing the code to do it.

GraphDiff provides DbContext extension methods for Entity Framework Code First, that allow you to save an entire detached Model/Entity, with child Entities and Lists, to the database without writing the code to do it. A NuGet package can be found here.

44 questions
35
votes
2 answers

Conditional mapping with graphdiff

I have following entities in my DbContext: public class A { public A() { Bs = new List(); } public ICollection Bs { set; get; } } Sometimes I Want to update a graph: var a = dbContext.As .AsNoTracking() …
Masoud
  • 8,020
  • 12
  • 62
  • 123
30
votes
1 answer

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 relationship, the related foreign-key property is…
Masoud
  • 8,020
  • 12
  • 62
  • 123
7
votes
1 answer

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;} public virtual ICollection
Ivan-Mark Debono
  • 15,500
  • 29
  • 132
  • 263
5
votes
1 answer

Casting an expression to another one

I have following expression Expression> expr1; Is there any way to cast it to Expression, object>>? [Update] Or create a new Expression, object>> from the existing…
Masoud
  • 8,020
  • 12
  • 62
  • 123
4
votes
1 answer

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 have been replaced. What am I missing as I expect…
m4gik
  • 430
  • 5
  • 27
4
votes
1 answer

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?
4
votes
1 answer

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) { using (var db = new DatabaseMappingContext()) { …
Nick Louloudakis
  • 5,856
  • 4
  • 41
  • 54
3
votes
0 answers

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 { var dbEntry = Context.Persons.SingleOrDefault(p…
Gr0m_
  • 31
  • 3
3
votes
1 answer

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 has two items the OrderItems table will have two…
Codehelp
  • 4,157
  • 9
  • 59
  • 96
3
votes
2 answers

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 with detached entities so I'm using…
Masoud
  • 8,020
  • 12
  • 62
  • 123
3
votes
1 answer

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 reading the DbContext disposes) Show readed…
Masoud
  • 8,020
  • 12
  • 62
  • 123
3
votes
1 answer

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. Conceptually, Block owns CalcPoints and PerfModes, but…
Matt
  • 67
  • 1
  • 7
3
votes
1 answer

Exception in Expression Trees

This is my model: - Business - BusinesType - FK - Categories (*) - FK - Branch (*) - BranchType - FK - Address - Phone (*) - CustomFields (*) - OpeningTimes (*) - WorkingPeriods (*) - ..... Now I have a…
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
2
votes
1 answer

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 contained register MyContext as IMyContext. Interface…
2
votes
1 answer

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 not using OData I can't use Delta and I would not…
Ivan-Mark Debono
  • 15,500
  • 29
  • 132
  • 263
1
2 3