コード例 #1
0
        public static Attempt <string> Copy(this IDataTypeService service, IDataType dataType, EntityContainer parent)
        {
            if (dataType == null)
            {
                return(Attempt.Fail(string.Empty, new NullReferenceException("Data Type Not Found")));
            }

            var clone = (IDataType)dataType.DeepClone();

            clone.Id  = 0;
            clone.Key = Guid.Empty;

            if (parent != null)
            {
                clone.SetParent(parent);
            }

            service.Save(clone);

            return(Attempt.Succeed(clone.Path));
        }