DDD, how to persist deletes on child entities with NHibernate?












0















Having an AggregateRoot and a list of child Entities, how do you persist the updated list of children after removing or updating one of them ?



This is an application layer service



  async Task HandleAsync(RemoveChildRequest request)
{
Aggregate aggregate = await _aggregateRepository.GetByIdAsync(request.AggregateId);

aggregate.RemoveChild(request.ChildId);

await _aggregateRepository.Update(aggregate);

await _unitOfWork.CommitAsync();
}


This is the Aggregate method of removing a child.



    public virtual void RemoveChild(Guid ChildId)
{
Child kid = _children.Single(item => item.Id == ChildId);

_children.Remove(kid);
}


And this is the repository
The aggregate is as it should be, has same data but without the child it was removed from the collection.



Update(Aggregate aggregate)
{
await Session.UpdateAsync(aggregate, aggregate.Id);
}


This is my NHibernate configuration



  mapping
.HasMany<Children>(Reveal.Member<Aggregate>("Children"))
.Not.Inverse()
.Not.KeyNullable()
.Not.KeyUpdate()
.Cascade.Delete();


After the commit is done, there is no update done against the DB. Somehow i feel is normal because, I only remove an entry from the children collection and that's all.



The structure



Aggregate 
{
private virtual IList<Child> _children;
protected virtual List<Child> Children { get => _children; }
}

Child
{

}


So only the parent holds a reference to the Child



I could do something like this in the Aggregate Repository



RemoveChild(Child kid) 
{
Session.DeleteAsync(kid);
}


But as far as I know, Repositories should be Aggregates specific only.



I'm interested in how the code that will actually persist the changes to the data store looks like? How do you remove the child. The Repository.










share|improve this question

























  • Possible duplicate of How to delete child object in NHibernate?

    – guillaume31
    Nov 23 '18 at 14:12
















0















Having an AggregateRoot and a list of child Entities, how do you persist the updated list of children after removing or updating one of them ?



This is an application layer service



  async Task HandleAsync(RemoveChildRequest request)
{
Aggregate aggregate = await _aggregateRepository.GetByIdAsync(request.AggregateId);

aggregate.RemoveChild(request.ChildId);

await _aggregateRepository.Update(aggregate);

await _unitOfWork.CommitAsync();
}


This is the Aggregate method of removing a child.



    public virtual void RemoveChild(Guid ChildId)
{
Child kid = _children.Single(item => item.Id == ChildId);

_children.Remove(kid);
}


And this is the repository
The aggregate is as it should be, has same data but without the child it was removed from the collection.



Update(Aggregate aggregate)
{
await Session.UpdateAsync(aggregate, aggregate.Id);
}


This is my NHibernate configuration



  mapping
.HasMany<Children>(Reveal.Member<Aggregate>("Children"))
.Not.Inverse()
.Not.KeyNullable()
.Not.KeyUpdate()
.Cascade.Delete();


After the commit is done, there is no update done against the DB. Somehow i feel is normal because, I only remove an entry from the children collection and that's all.



The structure



Aggregate 
{
private virtual IList<Child> _children;
protected virtual List<Child> Children { get => _children; }
}

Child
{

}


So only the parent holds a reference to the Child



I could do something like this in the Aggregate Repository



RemoveChild(Child kid) 
{
Session.DeleteAsync(kid);
}


But as far as I know, Repositories should be Aggregates specific only.



I'm interested in how the code that will actually persist the changes to the data store looks like? How do you remove the child. The Repository.










share|improve this question

























  • Possible duplicate of How to delete child object in NHibernate?

    – guillaume31
    Nov 23 '18 at 14:12














0












0








0








Having an AggregateRoot and a list of child Entities, how do you persist the updated list of children after removing or updating one of them ?



This is an application layer service



  async Task HandleAsync(RemoveChildRequest request)
{
Aggregate aggregate = await _aggregateRepository.GetByIdAsync(request.AggregateId);

aggregate.RemoveChild(request.ChildId);

await _aggregateRepository.Update(aggregate);

await _unitOfWork.CommitAsync();
}


This is the Aggregate method of removing a child.



    public virtual void RemoveChild(Guid ChildId)
{
Child kid = _children.Single(item => item.Id == ChildId);

_children.Remove(kid);
}


And this is the repository
The aggregate is as it should be, has same data but without the child it was removed from the collection.



Update(Aggregate aggregate)
{
await Session.UpdateAsync(aggregate, aggregate.Id);
}


This is my NHibernate configuration



  mapping
.HasMany<Children>(Reveal.Member<Aggregate>("Children"))
.Not.Inverse()
.Not.KeyNullable()
.Not.KeyUpdate()
.Cascade.Delete();


After the commit is done, there is no update done against the DB. Somehow i feel is normal because, I only remove an entry from the children collection and that's all.



The structure



Aggregate 
{
private virtual IList<Child> _children;
protected virtual List<Child> Children { get => _children; }
}

Child
{

}


So only the parent holds a reference to the Child



I could do something like this in the Aggregate Repository



RemoveChild(Child kid) 
{
Session.DeleteAsync(kid);
}


But as far as I know, Repositories should be Aggregates specific only.



I'm interested in how the code that will actually persist the changes to the data store looks like? How do you remove the child. The Repository.










share|improve this question
















Having an AggregateRoot and a list of child Entities, how do you persist the updated list of children after removing or updating one of them ?



This is an application layer service



  async Task HandleAsync(RemoveChildRequest request)
{
Aggregate aggregate = await _aggregateRepository.GetByIdAsync(request.AggregateId);

aggregate.RemoveChild(request.ChildId);

await _aggregateRepository.Update(aggregate);

await _unitOfWork.CommitAsync();
}


This is the Aggregate method of removing a child.



    public virtual void RemoveChild(Guid ChildId)
{
Child kid = _children.Single(item => item.Id == ChildId);

_children.Remove(kid);
}


And this is the repository
The aggregate is as it should be, has same data but without the child it was removed from the collection.



Update(Aggregate aggregate)
{
await Session.UpdateAsync(aggregate, aggregate.Id);
}


This is my NHibernate configuration



  mapping
.HasMany<Children>(Reveal.Member<Aggregate>("Children"))
.Not.Inverse()
.Not.KeyNullable()
.Not.KeyUpdate()
.Cascade.Delete();


After the commit is done, there is no update done against the DB. Somehow i feel is normal because, I only remove an entry from the children collection and that's all.



The structure



Aggregate 
{
private virtual IList<Child> _children;
protected virtual List<Child> Children { get => _children; }
}

Child
{

}


So only the parent holds a reference to the Child



I could do something like this in the Aggregate Repository



RemoveChild(Child kid) 
{
Session.DeleteAsync(kid);
}


But as far as I know, Repositories should be Aggregates specific only.



I'm interested in how the code that will actually persist the changes to the data store looks like? How do you remove the child. The Repository.







nhibernate architecture software-design






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 21:36







MCR

















asked Nov 22 '18 at 15:01









MCRMCR

547217




547217













  • Possible duplicate of How to delete child object in NHibernate?

    – guillaume31
    Nov 23 '18 at 14:12



















  • Possible duplicate of How to delete child object in NHibernate?

    – guillaume31
    Nov 23 '18 at 14:12

















Possible duplicate of How to delete child object in NHibernate?

– guillaume31
Nov 23 '18 at 14:12





Possible duplicate of How to delete child object in NHibernate?

– guillaume31
Nov 23 '18 at 14:12












3 Answers
3






active

oldest

votes


















1














Found my answer Here



nhibernate mapping: A collection with cascade="all-delete-orphan" was no longer referenced



and here



property Access strategies in nhibernate



NHibernate configuration



    mapping
.HasMany<Child>(Reveal.Member<Order>("Children"))
.Access.LowerCaseField(Prefix.Underscore)
.Cascade.AllDeleteOrphan()
.Not.KeyNullable()
.Not.KeyUpdate();





share|improve this answer































    -1














    Here is the way it is done with ByCode mapping, important is colmap.Cascade(Cascade.All). I hope this helps.



    public class Client
    {
    public virtual int ClientId { get; protected set; }
    public virtual string ClientName { get; protected set; }
    public virtual IList<ClientLocation> ClientLocations { get; protected set; }

    protected Client()
    {
    this.ClientLocations = new List<ClientLocation>();
    }
    }

    public class ClientLocation
    {
    public virtual int ClientLocationId { get; protected set; }
    public virtual Client Client { get; protected set; }
    public virtual string LocationName { get; protected set; }

    protected ClientBranch()
    {
    }
    }


    Mappings



    public class ClientMap : ClassMapping<Client>
    {
    public ClientMap() {
    Lazy(true);

    Id(x => x.ClientId, map => map.Generator(Generators.Identity));
    Property(x => x.ClientName);

    Bag(x => x.ClientLocations, colmap => { colmap.Key(x => x.Column("CLIENTID")); colmap.Cascade(Cascade.All); }, map => { map.OneToMany(); });
    }
    }


    public class ClientLocationMap : ClassMapping<ClientLocation>
    {
    public ClientLocationMap()
    {
    Lazy(true);

    Id(x => x.ClientLocationId, map => map.Generator(Generators.Identity));
    Property(x => x.LocationName);

    ManyToOne(x => x.Client, map => { map.Column("CLIENTID"); map.NotNullable(true); map.Cascade(Cascade.All); });
    }
    }





    share|improve this answer































      -2














      If the children belong to the aggregate root (i.e. composition instead of association), the removal or addition of the child entity must happen through the AggregateRoot and not independently. Moreover, children should be Value Objects and not aggregates in their own right.



      Therefore, you are right - the Repository would only fetch the parent. You would then have RemoveChild command that would act on that instance and post a ChildRemoved event which would take the child away from the list.






      share|improve this answer


























      • Yes, but how do you persist changes made upon the aggregate to a data store ? Can you maybe write a piece of code that does so, i'm interested only in how the piece of code that persists changes look like ? Let's say you want to delete, how would you do it ?

        – MCR
        Nov 23 '18 at 10:15








      • 1





        @AlessandroSantini Internal aggregate objects can be entities, they don't have to be value objects. Also, the original question doesn't mention the use of commands or events. I think an answer shouldn't imply these.

        – guillaume31
        Nov 23 '18 at 14:07











      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433657%2fddd-how-to-persist-deletes-on-child-entities-with-nhibernate%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Found my answer Here



      nhibernate mapping: A collection with cascade="all-delete-orphan" was no longer referenced



      and here



      property Access strategies in nhibernate



      NHibernate configuration



          mapping
      .HasMany<Child>(Reveal.Member<Order>("Children"))
      .Access.LowerCaseField(Prefix.Underscore)
      .Cascade.AllDeleteOrphan()
      .Not.KeyNullable()
      .Not.KeyUpdate();





      share|improve this answer




























        1














        Found my answer Here



        nhibernate mapping: A collection with cascade="all-delete-orphan" was no longer referenced



        and here



        property Access strategies in nhibernate



        NHibernate configuration



            mapping
        .HasMany<Child>(Reveal.Member<Order>("Children"))
        .Access.LowerCaseField(Prefix.Underscore)
        .Cascade.AllDeleteOrphan()
        .Not.KeyNullable()
        .Not.KeyUpdate();





        share|improve this answer


























          1












          1








          1







          Found my answer Here



          nhibernate mapping: A collection with cascade="all-delete-orphan" was no longer referenced



          and here



          property Access strategies in nhibernate



          NHibernate configuration



              mapping
          .HasMany<Child>(Reveal.Member<Order>("Children"))
          .Access.LowerCaseField(Prefix.Underscore)
          .Cascade.AllDeleteOrphan()
          .Not.KeyNullable()
          .Not.KeyUpdate();





          share|improve this answer













          Found my answer Here



          nhibernate mapping: A collection with cascade="all-delete-orphan" was no longer referenced



          and here



          property Access strategies in nhibernate



          NHibernate configuration



              mapping
          .HasMany<Child>(Reveal.Member<Order>("Children"))
          .Access.LowerCaseField(Prefix.Underscore)
          .Cascade.AllDeleteOrphan()
          .Not.KeyNullable()
          .Not.KeyUpdate();






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 9:57









          MCRMCR

          547217




          547217

























              -1














              Here is the way it is done with ByCode mapping, important is colmap.Cascade(Cascade.All). I hope this helps.



              public class Client
              {
              public virtual int ClientId { get; protected set; }
              public virtual string ClientName { get; protected set; }
              public virtual IList<ClientLocation> ClientLocations { get; protected set; }

              protected Client()
              {
              this.ClientLocations = new List<ClientLocation>();
              }
              }

              public class ClientLocation
              {
              public virtual int ClientLocationId { get; protected set; }
              public virtual Client Client { get; protected set; }
              public virtual string LocationName { get; protected set; }

              protected ClientBranch()
              {
              }
              }


              Mappings



              public class ClientMap : ClassMapping<Client>
              {
              public ClientMap() {
              Lazy(true);

              Id(x => x.ClientId, map => map.Generator(Generators.Identity));
              Property(x => x.ClientName);

              Bag(x => x.ClientLocations, colmap => { colmap.Key(x => x.Column("CLIENTID")); colmap.Cascade(Cascade.All); }, map => { map.OneToMany(); });
              }
              }


              public class ClientLocationMap : ClassMapping<ClientLocation>
              {
              public ClientLocationMap()
              {
              Lazy(true);

              Id(x => x.ClientLocationId, map => map.Generator(Generators.Identity));
              Property(x => x.LocationName);

              ManyToOne(x => x.Client, map => { map.Column("CLIENTID"); map.NotNullable(true); map.Cascade(Cascade.All); });
              }
              }





              share|improve this answer




























                -1














                Here is the way it is done with ByCode mapping, important is colmap.Cascade(Cascade.All). I hope this helps.



                public class Client
                {
                public virtual int ClientId { get; protected set; }
                public virtual string ClientName { get; protected set; }
                public virtual IList<ClientLocation> ClientLocations { get; protected set; }

                protected Client()
                {
                this.ClientLocations = new List<ClientLocation>();
                }
                }

                public class ClientLocation
                {
                public virtual int ClientLocationId { get; protected set; }
                public virtual Client Client { get; protected set; }
                public virtual string LocationName { get; protected set; }

                protected ClientBranch()
                {
                }
                }


                Mappings



                public class ClientMap : ClassMapping<Client>
                {
                public ClientMap() {
                Lazy(true);

                Id(x => x.ClientId, map => map.Generator(Generators.Identity));
                Property(x => x.ClientName);

                Bag(x => x.ClientLocations, colmap => { colmap.Key(x => x.Column("CLIENTID")); colmap.Cascade(Cascade.All); }, map => { map.OneToMany(); });
                }
                }


                public class ClientLocationMap : ClassMapping<ClientLocation>
                {
                public ClientLocationMap()
                {
                Lazy(true);

                Id(x => x.ClientLocationId, map => map.Generator(Generators.Identity));
                Property(x => x.LocationName);

                ManyToOne(x => x.Client, map => { map.Column("CLIENTID"); map.NotNullable(true); map.Cascade(Cascade.All); });
                }
                }





                share|improve this answer


























                  -1












                  -1








                  -1







                  Here is the way it is done with ByCode mapping, important is colmap.Cascade(Cascade.All). I hope this helps.



                  public class Client
                  {
                  public virtual int ClientId { get; protected set; }
                  public virtual string ClientName { get; protected set; }
                  public virtual IList<ClientLocation> ClientLocations { get; protected set; }

                  protected Client()
                  {
                  this.ClientLocations = new List<ClientLocation>();
                  }
                  }

                  public class ClientLocation
                  {
                  public virtual int ClientLocationId { get; protected set; }
                  public virtual Client Client { get; protected set; }
                  public virtual string LocationName { get; protected set; }

                  protected ClientBranch()
                  {
                  }
                  }


                  Mappings



                  public class ClientMap : ClassMapping<Client>
                  {
                  public ClientMap() {
                  Lazy(true);

                  Id(x => x.ClientId, map => map.Generator(Generators.Identity));
                  Property(x => x.ClientName);

                  Bag(x => x.ClientLocations, colmap => { colmap.Key(x => x.Column("CLIENTID")); colmap.Cascade(Cascade.All); }, map => { map.OneToMany(); });
                  }
                  }


                  public class ClientLocationMap : ClassMapping<ClientLocation>
                  {
                  public ClientLocationMap()
                  {
                  Lazy(true);

                  Id(x => x.ClientLocationId, map => map.Generator(Generators.Identity));
                  Property(x => x.LocationName);

                  ManyToOne(x => x.Client, map => { map.Column("CLIENTID"); map.NotNullable(true); map.Cascade(Cascade.All); });
                  }
                  }





                  share|improve this answer













                  Here is the way it is done with ByCode mapping, important is colmap.Cascade(Cascade.All). I hope this helps.



                  public class Client
                  {
                  public virtual int ClientId { get; protected set; }
                  public virtual string ClientName { get; protected set; }
                  public virtual IList<ClientLocation> ClientLocations { get; protected set; }

                  protected Client()
                  {
                  this.ClientLocations = new List<ClientLocation>();
                  }
                  }

                  public class ClientLocation
                  {
                  public virtual int ClientLocationId { get; protected set; }
                  public virtual Client Client { get; protected set; }
                  public virtual string LocationName { get; protected set; }

                  protected ClientBranch()
                  {
                  }
                  }


                  Mappings



                  public class ClientMap : ClassMapping<Client>
                  {
                  public ClientMap() {
                  Lazy(true);

                  Id(x => x.ClientId, map => map.Generator(Generators.Identity));
                  Property(x => x.ClientName);

                  Bag(x => x.ClientLocations, colmap => { colmap.Key(x => x.Column("CLIENTID")); colmap.Cascade(Cascade.All); }, map => { map.OneToMany(); });
                  }
                  }


                  public class ClientLocationMap : ClassMapping<ClientLocation>
                  {
                  public ClientLocationMap()
                  {
                  Lazy(true);

                  Id(x => x.ClientLocationId, map => map.Generator(Generators.Identity));
                  Property(x => x.LocationName);

                  ManyToOne(x => x.Client, map => { map.Column("CLIENTID"); map.NotNullable(true); map.Cascade(Cascade.All); });
                  }
                  }






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 29 '18 at 10:26









                  RajRaj

                  3917




                  3917























                      -2














                      If the children belong to the aggregate root (i.e. composition instead of association), the removal or addition of the child entity must happen through the AggregateRoot and not independently. Moreover, children should be Value Objects and not aggregates in their own right.



                      Therefore, you are right - the Repository would only fetch the parent. You would then have RemoveChild command that would act on that instance and post a ChildRemoved event which would take the child away from the list.






                      share|improve this answer


























                      • Yes, but how do you persist changes made upon the aggregate to a data store ? Can you maybe write a piece of code that does so, i'm interested only in how the piece of code that persists changes look like ? Let's say you want to delete, how would you do it ?

                        – MCR
                        Nov 23 '18 at 10:15








                      • 1





                        @AlessandroSantini Internal aggregate objects can be entities, they don't have to be value objects. Also, the original question doesn't mention the use of commands or events. I think an answer shouldn't imply these.

                        – guillaume31
                        Nov 23 '18 at 14:07
















                      -2














                      If the children belong to the aggregate root (i.e. composition instead of association), the removal or addition of the child entity must happen through the AggregateRoot and not independently. Moreover, children should be Value Objects and not aggregates in their own right.



                      Therefore, you are right - the Repository would only fetch the parent. You would then have RemoveChild command that would act on that instance and post a ChildRemoved event which would take the child away from the list.






                      share|improve this answer


























                      • Yes, but how do you persist changes made upon the aggregate to a data store ? Can you maybe write a piece of code that does so, i'm interested only in how the piece of code that persists changes look like ? Let's say you want to delete, how would you do it ?

                        – MCR
                        Nov 23 '18 at 10:15








                      • 1





                        @AlessandroSantini Internal aggregate objects can be entities, they don't have to be value objects. Also, the original question doesn't mention the use of commands or events. I think an answer shouldn't imply these.

                        – guillaume31
                        Nov 23 '18 at 14:07














                      -2












                      -2








                      -2







                      If the children belong to the aggregate root (i.e. composition instead of association), the removal or addition of the child entity must happen through the AggregateRoot and not independently. Moreover, children should be Value Objects and not aggregates in their own right.



                      Therefore, you are right - the Repository would only fetch the parent. You would then have RemoveChild command that would act on that instance and post a ChildRemoved event which would take the child away from the list.






                      share|improve this answer















                      If the children belong to the aggregate root (i.e. composition instead of association), the removal or addition of the child entity must happen through the AggregateRoot and not independently. Moreover, children should be Value Objects and not aggregates in their own right.



                      Therefore, you are right - the Repository would only fetch the parent. You would then have RemoveChild command that would act on that instance and post a ChildRemoved event which would take the child away from the list.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 22 '18 at 22:08

























                      answered Nov 22 '18 at 21:50









                      Alessandro SantiniAlessandro Santini

                      1,734913




                      1,734913













                      • Yes, but how do you persist changes made upon the aggregate to a data store ? Can you maybe write a piece of code that does so, i'm interested only in how the piece of code that persists changes look like ? Let's say you want to delete, how would you do it ?

                        – MCR
                        Nov 23 '18 at 10:15








                      • 1





                        @AlessandroSantini Internal aggregate objects can be entities, they don't have to be value objects. Also, the original question doesn't mention the use of commands or events. I think an answer shouldn't imply these.

                        – guillaume31
                        Nov 23 '18 at 14:07



















                      • Yes, but how do you persist changes made upon the aggregate to a data store ? Can you maybe write a piece of code that does so, i'm interested only in how the piece of code that persists changes look like ? Let's say you want to delete, how would you do it ?

                        – MCR
                        Nov 23 '18 at 10:15








                      • 1





                        @AlessandroSantini Internal aggregate objects can be entities, they don't have to be value objects. Also, the original question doesn't mention the use of commands or events. I think an answer shouldn't imply these.

                        – guillaume31
                        Nov 23 '18 at 14:07

















                      Yes, but how do you persist changes made upon the aggregate to a data store ? Can you maybe write a piece of code that does so, i'm interested only in how the piece of code that persists changes look like ? Let's say you want to delete, how would you do it ?

                      – MCR
                      Nov 23 '18 at 10:15







                      Yes, but how do you persist changes made upon the aggregate to a data store ? Can you maybe write a piece of code that does so, i'm interested only in how the piece of code that persists changes look like ? Let's say you want to delete, how would you do it ?

                      – MCR
                      Nov 23 '18 at 10:15






                      1




                      1





                      @AlessandroSantini Internal aggregate objects can be entities, they don't have to be value objects. Also, the original question doesn't mention the use of commands or events. I think an answer shouldn't imply these.

                      – guillaume31
                      Nov 23 '18 at 14:07





                      @AlessandroSantini Internal aggregate objects can be entities, they don't have to be value objects. Also, the original question doesn't mention the use of commands or events. I think an answer shouldn't imply these.

                      – guillaume31
                      Nov 23 '18 at 14:07


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433657%2fddd-how-to-persist-deletes-on-child-entities-with-nhibernate%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      404 Error Contact Form 7 ajax form submitting

                      How to know if a Active Directory user can login interactively

                      Refactoring coordinates for Minecraft Pi buildings written in Python