Ejemplo n.º 1
0
        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();
 }
Ejemplo n.º 3
0
 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)));
 }
Ejemplo n.º 4
0
 internal void CompleteChildLists(MetadataChildRef childRef)
 {
     if (this.FCompletedChildRefs == null)
     {
         this.FCompletedChildRefs = new bool[this.Class.Childs.Count];
     }
     this.FCompletedChildRefs[childRef.Index] = true;
 }
Ejemplo n.º 5
0
 public ChildNavigationStep(
     SqlUtils.Navigation navigation,
     SqlUtils.NavigationStep predecessor,
     string path,
     MetadataChildRef childRef)
     : base(navigation, predecessor, path)
 {
     this.ChildRef = childRef;
 }
Ejemplo n.º 6
0
 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));
     }
 }
Ejemplo n.º 7
0
 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);
     }
 }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 12
0
 public ChildRefLoadPlan EnsureChildRef(MetadataChildRef childRef, LoadPlan plan) => this.EnsureChildRef(childRef, plan, new LoadPlan.MergedPlans());
Ejemplo n.º 13
0
 public UnplannedChildrenLoadingEventArgs(MetadataChildRef childRef) => this.ChildRef = childRef;
Ejemplo n.º 14
0
 public ChildRefLoadPlan(MetadataChildRef childRef, LoadPlan plan)
 {
     this.ChildRef = childRef;
     this.Plan     = LoadPlan.UseExistingOrCreateNew(plan, childRef.ChildClass);
 }
Ejemplo n.º 15
0
 protected internal virtual DataObjectChildList CreateChildListInstance(
     DataObject owner,
     MetadataChildRef childRef)
 {
     return(new DataObjectChildList(owner, childRef));
 }
Ejemplo n.º 16
0
 internal bool IsChildListCompleted(MetadataChildRef childRef) => this.FCompletedChildRefs != null && this.FCompletedChildRefs[childRef.Index];