예제 #1
0
        private void SetAssociationKeyInfo(MetaAssociation association)
        {
            DLinqColumnProvider column = (DLinqColumnProvider)FromColumn;

            List <string> foreignKeyNames = new List <string>();

            int count = column.Member.Association.ThisKey.Count;

            for (int i = 0; i < count; i++)
            {
                MetaDataMember thisKeyMetaDataMember  = column.Member.Association.ThisKey[i];
                MetaDataMember otherKeyMetaDataMember = column.Member.Association.OtherKey[i];

                DLinqColumnProvider thisEntityMemberComponent = FindColumn(column.Table, thisKeyMetaDataMember.Name);

                if (ShouldRemoveThisAssociation(association))
                {
                    column.ShouldRemove = true;
                    return;
                }

                foreignKeyNames.Add(thisEntityMemberComponent.Name);

                if (thisEntityMemberComponent.IsPrimaryKey)
                {
                    IsPrimaryKeyInThisTable = true;
                }
                if (association.IsForeignKey)
                {
                    thisEntityMemberComponent.IsForeignKeyComponent = true;
                }
            }

            ForeignKeyNames = new ReadOnlyCollection <string>(foreignKeyNames);
        }
        public DLinqAssociationProvider(DLinqColumnProvider column) {
            FromColumn = column;

            MetaAssociation association = column.Member.Association;

            SetOtherEndOfAssociation(association);

            SetDirection(association);
            Debug.Assert(Direction != AssociationDirection.ManyToMany, "Many to Many is not supported by Linq to SQL");

            SetAssociationKeyInfo(association);
        }
예제 #3
0
        public DLinqAssociationProvider(DLinqColumnProvider column)
        {
            FromColumn = column;

            MetaAssociation association = column.Member.Association;

            SetOtherEndOfAssociation(association);

            SetDirection(association);
            Debug.Assert(Direction != AssociationDirection.ManyToMany, "Many to Many is not supported by Linq to SQL");

            SetAssociationKeyInfo(association);
        }
        private void AddColumn(DLinqDataModelProvider dataModel, MetaDataMember member, PropertyInfo propInfo) {
            var publicGetAccessor = propInfo.GetGetMethod();
            if (publicGetAccessor == null) {
                // the property at least needs to have a public getter, otherwise databinding will not work
                return;
            }

            DLinqColumnProvider column = new DLinqColumnProvider(this, member);
            _columns.Add(column);

            if (!dataModel.ColumnLookup.ContainsKey(propInfo))
                dataModel.ColumnLookup[propInfo] = column;
        }
예제 #5
0
        private void AddColumn(DLinqDataModelProvider dataModel, MetaDataMember member, PropertyInfo propInfo)
        {
            var publicGetAccessor = propInfo.GetGetMethod();

            if (publicGetAccessor == null)
            {
                // the property at least needs to have a public getter, otherwise databinding will not work
                return;
            }

            DLinqColumnProvider column = new DLinqColumnProvider(this, member);

            _columns.Add(column);

            if (!dataModel.ColumnLookup.ContainsKey(propInfo))
            {
                dataModel.ColumnLookup[propInfo] = column;
            }
        }
예제 #6
0
		public DLinqAssociationProvider (DLinqColumnProvider provider)
		{
		}
 public DLinqAssociationProvider(DLinqColumnProvider provider)
 {
 }