Ejemplo n.º 1
0
 internal void Initialize()
 {
     if (this._isAssociation && (this._association == null))
     {
         this._association = new ALinqAssociationProvider(this);
     }
 }
Ejemplo n.º 2
0
        protected internal override void Initialize()
        {
            base.Initialize();
            AssociationProvider association = base.Provider.Association;

            this.ChildTable = base.Model.GetTable(association.ToTable.Name, base.Table.DataContextType);
            if (association.ToColumn != null)
            {
                this.ColumnInOtherTable = this.ChildTable.GetColumn(association.ToColumn.Name);
            }
        }
Ejemplo n.º 3
0
        internal override void Init()
        {
            AssociationProvider association = Provider.Association;
            ColumnProvider      otherColumn = association.ToColumn;
            string    otherColumnName       = otherColumn == null ? null : otherColumn.Name;
            MetaTable childTable            = Model.GetTable(association.ToTable.Name, Table.DataContextType);

            ChildTable = childTable;
            if (childTable != null && !String.IsNullOrEmpty(otherColumnName))
            {
                ColumnInOtherTable = childTable.GetColumn(otherColumnName);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Perform initialization logic for this column
        /// </summary>
        internal protected override void Initialize()
        {
            base.Initialize();

            AssociationProvider a = this.Provider.Association;

            ChildTable = Model.GetTable(a.ToTable.Name, Table.DataContextType);

            if (a.ToColumn != null)
            {
                ColumnInOtherTable = ChildTable.GetColumn(a.ToColumn.Name);
            }
        }
        public void ResolveAssociations()
        {
            if (associationResolved)
            {
                return;
            }

            associationResolved = true;
            string associated = column.AssociatedTo;

            if (String.IsNullOrEmpty(associated))
            {
                return;
            }

            string[] names = associated.Split(new char[] { '.' });
            if (names.Length != 2)
            {
                throw new ApplicationException("Only associations of type Table.Column are supported");
            }
            string tableName  = names[0];
            string columnName = names[1];

            TableProvider tableProvider = null;

            try {
                tableProvider = Table.DataModel.Tables.First <TableProvider> ((TableProvider tp) => {
                    if (tp.Name == tableName)
                    {
                        return(true);
                    }
                    return(false);
                });
            } catch {
                return;
            }

            if (tableProvider == null)
            {
                return;
            }

            ColumnProvider toColumn = null;

            try {
                toColumn = tableProvider.Columns.First <ColumnProvider> ((ColumnProvider cp) => {
                    if (cp.Name == columnName)
                    {
                        return(true);
                    }
                    return(false);
                });
            } catch {
                return;
            }

            if (toColumn == null)
            {
                return;
            }

            IsForeignKeyComponent = true;
            Association           = new DynamicDataAssociationProvider(column.AssociationDirection, this, toColumn);
        }