Separate table for Value Objects on NHibernate

前端 未结 2 1928
野的像风
野的像风 2021-01-03 07:01

I\'m new to DDD and NHibernate.

In my current project, I have an entity Person, that contains a value object, let\'s say Address. Today, this is fine. But maybe one

2条回答
  •  失恋的感觉
    2021-01-03 07:28

    You can Join and make it a Component allowing nHibernate to map it as a proper value object instead of an entity.

    This way you won't need any virtual properties nor an empty protected ctor (it can be private).

    Join("PROPOSAL_PRODUCT", product =>
    {
        product.Schema(IsaSchema.PROPOSALOWN);
        product.KeyColumn("PROPOSAL_ID");
    
        product.Component(Reveal.Member("_product"), proposalProduct =>
        {
            proposalProduct.Map...
        });
    });
    

提交回复
热议问题