Something like this?
What I see here: is that my valueobject is not in the table... That 's
another issue.
----
public class Product:RootEntity<Guid>
{
private ProductInitiatorUnity productInitiatorUnity;
public virtual ProductInitiatorUnity ProductInitiatorUnity
{
get { return productInitiatorUnity ?? new
ProductInitiatorUnity(); }
}
[Audited(WithModifiedFlag = true)]
public virtual string ArticleNumber { get; protected set; }
[Audited]
public virtual string LastChangedBy { get; protected set; }
[Audited]
public virtual DateTime LastChangedOn { get; protected set; }
[Audited(WithModifiedFlag = true)]
public virtual IParameter PickMethod { get; protected set; }
[Audited(WithModifiedFlag = true)]
public virtual IParameter ReceivingCode { get; protected set; }
}
public class ReceivingCode: Parameter
{
[Audited]
public override string Code
{
get
{
return base.Code;
}
protected set
{
base.Code = value;
}
}
[Audited]
public override string LastChangedBy
{
get
{
return base.LastChangedBy;
}
protected set
{
base.LastChangedBy = value;
}
}
[Audited]
public override System.DateTime LastChangedOn
{
get
{
return base.LastChangedOn;
}
protected set
{
base.LastChangedOn = value;
}
}
}
public class PickMethod: Parameter
{
[Audited]
public override string Code
{
get
{
return base.Code;
}
protected set
{
base.Code = value;
}
}
[Audited]
public override string LastChangedBy
{
get
{
return base.LastChangedBy;
}
protected set
{
base.LastChangedBy = value;
}
}
[Audited]
public override System.DateTime LastChangedOn
{
get
{
return base.LastChangedOn;
}
protected set
{
base.LastChangedOn = value;
}
}
}
public class ProductInitiatorUnity : ValueObject
{
[Audited(WithModifiedFlag = true)]
public virtual InitiatorUnity InitiatorUnity { get; protected set; }
[Audited(WithModifiedFlag = true)]
public virtual InitiatorUnity WmsUnity { get; protected set; }
[Audited(WithModifiedFlag = true)]
public virtual int InitiatorQuantity { get; protected set; }
[Audited(WithModifiedFlag = true)]
public virtual int WmsQuantity { get; protected set; }
protected internal ProductInitiatorUnity()
{
}
protected internal ProductInitiatorUnity(InitiatorUnity
initiatorUnity, int initiatorQuantity, InitiatorUnity wmsUnity, int
wmsQuantiy)
{
InitiatorUnity = initiatorUnity;
InitiatorQuantity = initiatorQuantity;
WmsUnity = wmsUnity;
WmsQuantity = wmsQuantiy;
}
}
Product.hbm.xml
<class name="Pdc.Erp.Domain.ProductManagement.Product" table="Product"
dynamic-update="true" >
<cache usage="read-write" include="all"/>
<id name="Id" column="id">
<generator class="guid.comb" />
</id>
<version name="Version" column="ver" type="Int64" />
<property name="ArticleNumber" column="article_number" length="20"
not-null="true" unique-key="IX_Initiator_ArticleNumber" />
<many-to-one name="ReceivingCode"
class="Pdc.Erp.Domain.ProductManagement.Parameters.ReceivingCode,
Pdc.Erp.Domain.Core" column="receiving_code_id" not-null="true"
foreign-key="FK_Product_ReceivingCode"/>
<many-to-one name="PickMethod"
class="Pdc.Erp.Domain.ProductManagement.Parameters.PickMethod,
Pdc.Erp.Domain.Core" column="pick_method_id" not-null="true"
foreign-key="FK_Product_PickMethod"/>
<component name="ProductInitiatorUnity"
class="Pdc.Erp.Domain.ProductManagement.ProductInitiatorUnity"
access="nosetter.camelcase">
<many-to-one name="InitiatorUnity" column="initiator_unity_id"
class="Pdc.Erp.Domain.ProductManagement.Parameters.InitiatorUnity"
not-null="false" foreign-key="FK_Product_InitiatorUnity" />
<property name="InitiatorQuantity" column="initiator_unity_quantity"
/>
<many-to-one name="WmsUnity" column="initiator_unity_wms_id"
class="Pdc.Erp.Domain.ProductManagement.Parameters.InitiatorUnity"
not-null="false" foreign-key="FK_Product_InitiatorUnity_Wms" />
<property name="WmsQuantity" column="initiator_unity_wms_quantity" />
</component>
<property name="LastChangedBy" column="modifier" length="100"
not-null="true" />
<property name="LastChangedOn" column="modified" not-null="true" />
</>
Generated sql:
CREATE TABLE [dbo].[Product_AUD](
[id] [uniqueidentifier] NOT NULL,
[REV] [int] NOT NULL,
[REVTYPE] [tinyint] NOT NULL,
[article_number] [nvarchar](20) NULL,
[ArticleNumber_MOD] [bit] NULL,
[modifier] [nvarchar](100) NULL,
[modified] [datetime] NULL,
[receiving_code_id] [uniqueidentifier] NULL,
[ReceivingCode_MOD] [bit] NULL,
[pick_method_id] [uniqueidentifier] NULL,
[PickMethod_MOD] [bit] NULL,
CONSTRAINT [PK_Product_AUD] PRIMARY KEY CLUSTERED
(
[id] ASC,
[REV] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [DATA]
) ON [DATA]
2013/10/29 Roger Kratz <[email protected]>
> Can you show us some simple mapping + code?****
>
> ** **
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *kriebb
> *Sent:* den 29 oktober 2013 15:06
> *To:* [email protected]
> *Subject:* [nhusers] [Nhibernate.Envers] [1.6 GA] property auditing check*
> ***
>
> ** **
>
> Hi,****
>
> ** **
>
> We've setup the auditing on property level.****
>
> Everything works except some small stuff.****
>
> ** **
>
> The most important thing first:****
>
> ** **
>
> We are tracking on property bases, also with the flag if the property has
> changed. We are tracking now 7 property's.****
>
> ** **
>
> The thing is, we even got updates in the table, even if there is no
> changes detected.****
>
> Another entity is updated tough.****
>
> ** **
>
> We won't want that information in our tables.****
>
> If nothing of those properties has changed, we are not interested in the
> information.****
>
> ** **
>
> Any tips/hints where I can look for or can override this behavior?****
>
> ** **
>
> Thanks,****
>
> ** **
>
> ** **
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/groups/opt_out.****
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "nhusers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nhusers/lDQxk56fUh0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.