Example #1
0
        public override IEnumerable <DynamicPropertyInfo> GetStructuralProperties(String tableName)
        {
            SchemaContext schemaContext = _dbContextPool.Rent();

            foreach (DbColumn column in schemaContext.GetColumns(tableName))
            {
                DatabaseGeneratedOption databaseGenerated;
                if (column.IsIdentity.GetValueOrDefault())
                {
                    databaseGenerated = DatabaseGeneratedOption.Identity;
                }
                else if (column.IsExpression.GetValueOrDefault())
                {
                    databaseGenerated = DatabaseGeneratedOption.Computed;
                }
                else
                {
                    databaseGenerated = DatabaseGeneratedOption.None;
                }
                yield return(new DynamicPropertyInfo(column.ColumnName, column.DataType, databaseGenerated));
            }
            _dbContextPool.Return(schemaContext);
        }