예제 #1
0
 private void AssignNewGenerationId(PropModelType propModel, long generationId)
 {
     if (propModel.IsFixed)
     {
         propModel.Open();
         propModel.GenerationId = generationId;
         TryFix(propModel);
     }
     else
     {
         propModel.GenerationId = generationId;
     }
 }
예제 #2
0
        // Make a copy and if a new class name is given, start a new family of Type definitions.
        public PropModelType Open(PropModelType propModel, string fullClassName, out long generationId)
        {
            if (!propModel.IsFixed)
            {
                if (fullClassName == null)
                {
                    System.Diagnostics.Debug.WriteLine("Already Open.");
                    generationId = propModel.GenerationId;
                    return(propModel);
                }
                else
                {
                    throw new InvalidOperationException($"Cannot open the PropModel with FullClassName: {this}; it is already open.");
                }
            }
            else
            {
                propModel.PropModelCache = null;
                PropModelType result = (PropModelType)propModel.CloneIt();
                result.Open();

                if (fullClassName != null)
                {
                    string ns = GetNamespace(fullClassName, out string className);

                    if (ns != null)
                    {
                        result.NamespaceName = ns;
                    }

                    result.ClassName = className;
                }

                generationId = Add(result);
                return(result);
            }
        }