How to use the GraphDiff Entity Framework Code First

1

I have the following tables in my database:

  • Sale
  • Sales Details
  • Products Sales
  • Plots
  • The relationship is as follows:

    • 1 Sale = > N Sales Details
    • 1 Sale = > N Products Sales
    • 1 Sales Details = > N Plots

    I'm trying to make the method to add a new sale, however I'm not getting results, the method does not give error, but when I go check in the database, the record has not been saved.

    The following is the code for my method:

    public Venda LancamentoVenda(Venda obj)
    {
        Db.UpdateGraph(obj, map => map
         .OwnedCollection(d => d.DetalhesVenda, r => r.AssociatedCollection(a => a.Parcelas))
         .OwnedCollection(x => x.ProdutosVendas));
        return obj;
    }
    
        
    asked by anonymous 11.06.2018 / 14:31

    0 answers