// Not ported - ToString( object value, ISessionFactoryImplementor factory ) // - PesistentCollectionType implementation is able to handle arrays too in .NET /// <summary> /// /// </summary> /// <param name="original"></param> /// <param name="target"></param> /// <param name="session"></param> /// <param name="owner"></param> /// <param name="copiedAlready"></param> /// <returns></returns> public override object Copy(object original, object target, ISessionImplementor session, object owner, IDictionary copiedAlready) { if (original == null) { return(null); } if (original == target) { return(target); } System.Array orig = (System.Array)original; int length = orig.Length; System.Array result = System.Array.CreateInstance(elementClass, length); IType elemType = GetElementType(session.Factory); for (int i = 0; i < length; i++) { result.SetValue( elemType.Copy(orig.GetValue(i), null, session, owner, copiedAlready), i); } return(result); }
public void Copy(IType type, TaskContext context) { type.Dispatcher.Invoke(() => { var categories = type.GetService(typeof(ITypeCategoryCollection)) as ITypeCategoryCollection; var categoryPath = categories.Random().Path; var typeName = RandomUtility.NextIdentifier(); type.Copy(context.Authentication, typeName, categoryPath); }); }
public override object Copy(object original, object target, ISessionImplementor session, object owner, IDictionary copyCache) { if (original == null) { return(null); } object cached = copyCache[original]; if (cached != null) { return(cached); } else { if (original == target) { return(target); } IType idType = GetIdentifierOrUniqueKeyType(session.Factory); object id = GetIdentifier(original, session); if (id == null) { throw new AssertionFailure("cannot copy a reference to an object with a null id"); } id = idType.Copy(id, null, session, owner, copyCache); // Replace a property-ref'ed entity by its id if (uniqueKeyPropertyName != null && idType.IsEntityType) { id = (( EntityType )idType).GetIdentifier(id, session); } return(ResolveIdentifier(id, session, owner)); } }
public void Copy() { type.Copy(authentication, RandomUtility.NextIdentifier(), PathUtility.Separator); }