/// <summary> /// /// </summary> /// <param name="component"></param> /// <returns></returns> public override object DeepCopy(object component) { if (component == null) { return(null); } object[] values = GetPropertyValues(component); for (int i = 0; i < propertySpan; i++) { values[i] = propertyTypes[i].DeepCopy(values[i]); } object result = Instantiate(); SetPropertyValues(result, values); // TODO NH: The code below is present in H2.1, but it breaks some // tests in NH because FooComponent.Parent setter throws // an exception if setting parent to null. // // not absolutely necessary, but helps for some // Equals/GetHashCode implementations // if (parentGetter != null) { parentSetter.Set(result, parentGetter.Get(component)); } return(result); }
public override ExecuteResult Execute(Context context) { var dat = SRC.Get(); DST.Set(dat); return(new ExecuteResult(true)); }
public void Set(object value) { _inheritSetter.Set(value); var param = _dependencProperty.Select(w => _type.GetProperty(w.Name).GetValue(_entity, null)).ToArray(); var result = _method.Invoke(null, param); _setter.Set(result); }
public override void SetParent(object component, object parent, Engine.ISessionFactoryImplementor factory) { if (isBytecodeProviderImpl && optimizer?.AccessOptimizer != null) { optimizer.AccessOptimizer.SetSpecializedPropertyValue(component, parent); return; } parentSetter.Set(component, parent); }
public override void EntityChanged(System.Type entityClass, string entityName, object entityId, RevisionType revisionType, object revisionEntity) { base.EntityChanged(entityClass, entityName, entityId, revisionType, revisionEntity); var modifiedEntityNames = (ISet <string>)modifiedEntityTypesGetter.Get(revisionEntity); if (modifiedEntityNames == null) { modifiedEntityNames = new HashSet <string>(); modifiedEntityTypesSetter.Set(revisionEntity, modifiedEntityNames); } modifiedEntityNames.Add(entityName); }
public object Generate() { var revisionInfo = Activator.CreateInstance(_revisionInfoType); var utcNow = DateTime.UtcNow; var value = _timestampAsDate ? (object)utcNow : utcNow.Ticks; _revisionTimestampSetter.Set(revisionInfo, value); _listener?.NewRevision(revisionInfo); return(revisionInfo); }
public void SetIdentifier(object entity, object id) { if (entityMetamodel.IdentifierProperty.IsEmbedded) { if (entity != id) { IAbstractComponentType copier = (IAbstractComponentType)entityMetamodel.IdentifierProperty.Type; copier.SetPropertyValues(entity, copier.GetPropertyValues(id, EntityMode), EntityMode); } } else if (idSetter != null) { idSetter.Set(entity, id); } }
public void CompanyElementGeneration() { ISetter idSetter = PropertyAccessorFactory.GetPropertyAccessor(GenerateIdProperty(), EntityMode.Xml).GetSetter(null, null); ISetter nameSetter = PropertyAccessorFactory.GetPropertyAccessor(GenerateNameProperty(), EntityMode.Xml).GetSetter(null, null); ISetter textSetter = PropertyAccessorFactory.GetPropertyAccessor(GenerateTextProperty(), EntityMode.Xml).GetSetter(null, null); ISetter accountIdSetter = PropertyAccessorFactory.GetPropertyAccessor(GenerateAccountIdProperty(), EntityMode.Xml).GetSetter(null, null); XmlNode root = GenerateRootTestElement(); idSetter.Set(root, 123L); textSetter.Set(root, "description..."); nameSetter.Set(root, "NHForge"); accountIdSetter.Set(root, 456L); Console.WriteLine(dom.OuterXml); //Assert.That(new NodeComparator().Compare(dom, root) == 0); }
protected virtual void SetIdentifierPropertyValue(object entity, object value) { idSetter.Set(entity, value); }
public void SetValue() { Assert.AreEqual(0, _getter.Get(_instance)); _setter.Set(_instance, 5); Assert.AreEqual(5, _getter.Get(_instance)); }
public override void SetParent(object component, object parent, Engine.ISessionFactoryImplementor factory) { parentSetter.Set(component, parent); }
public static void Set <TValue>(this ISetter <string, object> setter, string key, TValue value) { setter.Set(key, value, typeof(TValue)); }