コード例 #1
0
        public InsqlEntityPropertyBuilder(IInsqlEntityMap entityMap, PropertyInfo propertyInfo)
        {
            if (entityMap.Properties.Any(o => o.PropertyInfo.Name == propertyInfo.Name))
            {
                throw new Exception($"insql entity builder type : {entityMap.EntityType} `{propertyInfo.Name}` property have been mapped!");
            }

            this.entityMap = entityMap;

            this.propertyMap = new InsqlPropertyMap(propertyInfo);

            this.entityMap.Properties.Add(this.propertyMap);
        }
コード例 #2
0
        public void Validate(IInsqlEntityMap entityMap)
        {
            foreach (var groupItem in entityMap.Properties.Where(item => !item.IsIgnored).GroupBy(item => item.ColumnName))
            {
                if (groupItem.Count() > 1)
                {
                    throw new Exception($"insql entity type : {entityMap.EntityType} `{groupItem.Key}` column name already exist!");
                }
            }

            if (entityMap.Properties.Where(item => !item.IsIgnored).Count(item => item.IsIdentity) > 1)
            {
                throw new Exception($"insql entity type : {entityMap.EntityType} identity column already exist!");
            }
        }
コード例 #3
0
ファイル: DapperTypeMap.cs プロジェクト: ikvm/IBatisNet.Core
        public DapperTypeMap(IInsqlEntityMap entityMap)
        {
            this.entityMap = entityMap;

            this.typeMap = new CustomPropertyTypeMap(entityMap.EntityType, this.GetProperty);
        }