public override object DeepCopy(object component, ISessionFactoryImplementor factory) { if (component == null) { return(null); } object[] values = GetPropertyValues(component); for (int i = 0; i < propertySpan; i++) { values[i] = propertyTypes[i].DeepCopy(values[i], factory); } object result = Instantiate(); SetPropertyValues(result, values); //not absolutely necessary, but helps for some //equals()/hashCode() implementations if (ComponentTuplizer.HasParentProperty) { ComponentTuplizer.SetParent(result, ComponentTuplizer.GetParent(component), factory); } return(result); }
public virtual object Instantiate(object parent, ISessionImplementor session) { object result = Instantiate(); if (ComponentTuplizer.HasParentProperty && parent != null) { ComponentTuplizer.SetParent(result, session.PersistenceContext.ProxyFor(parent), session.Factory); } return(result); }