public bool TryFindMember(
            string memberName,
            out MetadataProperty property,
            out MetadataChildRef childRef)
        {
            property = this.Properties.Find(memberName);
            if (property != null)
            {
                childRef = (MetadataChildRef)null;
                return(true);
            }
            MetadataClass byIdentName = this.Metadata.Classes.FindByIdentName(memberName);

            if (byIdentName != null)
            {
                childRef = this.Childs.Find(byIdentName);
                if (childRef != null)
                {
                    return(true);
                }
            }
            else
            {
                childRef = (MetadataChildRef)null;
            }
            return(false);
        }
 protected internal DataObjectChildList(DataObject owner, MetadataChildRef childRef)
 {
     this.Object      = owner;
     this.ChildRef    = childRef;
     this.FIsComplete = owner.IsNew;
     this.FItems      = new ArrayList();
 }
 public DataObjectChildList GetChilds(MetadataChildRef childRef)
 {
     this.CheckNotUntypedNull();
     this.CheckNotError();
     DataObjectChildList[] dataObjectChildListArray = this.FChilds ?? (this.FChilds = new DataObjectChildList[this.Class.Childs.Count]);
     return(dataObjectChildListArray[childRef.Index] ?? (dataObjectChildListArray[childRef.Index] = this.Session[childRef.ChildClass].CreateChildListInstance(this, childRef)));
 }
Example #4
0
 internal void CompleteChildLists(MetadataChildRef childRef)
 {
     if (this.FCompletedChildRefs == null)
     {
         this.FCompletedChildRefs = new bool[this.Class.Childs.Count];
     }
     this.FCompletedChildRefs[childRef.Index] = true;
 }
Example #5
0
 public ChildNavigationStep(
     SqlUtils.Navigation navigation,
     SqlUtils.NavigationStep predecessor,
     string path,
     MetadataChildRef childRef)
     : base(navigation, predecessor, path)
 {
     this.ChildRef = childRef;
 }
 public void NeedMember(
     string memberName,
     out MetadataProperty property,
     out MetadataChildRef childRef)
 {
     if (!this.TryFindMember(memberName, out property, out childRef))
     {
         throw new DataException(string.Format("\"{0}\" не является ни свойством, ни дочерним классом.", (object)memberName));
     }
 }
 private static void GenerateChilds(MetadataClass cls, StringBuilder sb)
 {
     for (int index = 0; index < cls.Childs.Count; ++index)
     {
         MetadataChildRef child      = cls.Childs[index];
         MetadataClass    childClass = child.ChildClass;
         CodeGenerator.GenerateDoc("\t", "summary", childClass.Caption, sb);
         sb.AppendFormat("\tpublic {0}ChildList {1} {{ get {{ return ({0}ChildList)base.GetChilds(Meta.{1}); }} }}\n", (object)childClass.QTypeName, (object)child.MemberName);
     }
 }
        internal void RemoveChild(DataObject child, bool checkWriting)
        {
            DataObjectChildList[] fchilds = this.FChilds;
            if (fchilds == null)
            {
                return;
            }
            MetadataChildRef metadataChildRef = this.Class.Childs.Need(child.Class);

            fchilds[metadataChildRef.Index]?.RemoveChild(child, checkWriting);
        }
Example #9
0
        internal MetadataChildRef Ensure(MetadataAssociationRef ownerRef)
        {
            MetadataChildRef metadataChildRef = this.Find(ownerRef.Association.Class);

            if (metadataChildRef == null)
            {
                metadataChildRef = new MetadataChildRef(ownerRef, this.FItems.Count);
                this.FItems.Add(metadataChildRef);
            }
            return(metadataChildRef);
        }
Example #10
0
 public MetadataChildRef Find(MetadataClass childClass)
 {
     for (int index = 0; index < this.FItems.Count; ++index)
     {
         MetadataChildRef metadataChildRef = this[index];
         if (metadataChildRef.ChildClass == childClass)
         {
             return(metadataChildRef);
         }
     }
     return((MetadataChildRef)null);
 }
Example #11
0
        private ChildRefLoadPlan EnsureChildRef(
            MetadataChildRef childRef,
            LoadPlan plan,
            LoadPlan.MergedPlans mergedPlans)
        {
            for (int index = 0; index < this.Childs.Count; ++index)
            {
                ChildRefLoadPlan child = this.Childs[index];
                if (child.ChildRef == childRef)
                {
                    child.Plan.MergeWith(plan, mergedPlans);
                    return(child);
                }
            }
            ChildRefLoadPlan childRefLoadPlan = new ChildRefLoadPlan(childRef, plan);

            this.Childs.Add((object)childRefLoadPlan);
            return(childRefLoadPlan);
        }
Example #12
0
 public ChildRefLoadPlan EnsureChildRef(MetadataChildRef childRef, LoadPlan plan) => this.EnsureChildRef(childRef, plan, new LoadPlan.MergedPlans());
Example #13
0
 public UnplannedChildrenLoadingEventArgs(MetadataChildRef childRef) => this.ChildRef = childRef;
Example #14
0
 public ChildRefLoadPlan(MetadataChildRef childRef, LoadPlan plan)
 {
     this.ChildRef = childRef;
     this.Plan     = LoadPlan.UseExistingOrCreateNew(plan, childRef.ChildClass);
 }
Example #15
0
 protected internal virtual DataObjectChildList CreateChildListInstance(
     DataObject owner,
     MetadataChildRef childRef)
 {
     return(new DataObjectChildList(owner, childRef));
 }
Example #16
0
 internal bool IsChildListCompleted(MetadataChildRef childRef) => this.FCompletedChildRefs != null && this.FCompletedChildRefs[childRef.Index];