Beispiel #1
0
    public static TableData CreateTableDataFromType(Type type)
    {
        var tableName         = GetTableName(type);
        var tableCreationData = new TableData()
        {
            TableName = tableName, SourceType = type
        };
        var columnCreationDatas = type
                                  .GetBasePropertiesFirst()
                                  .Where(z => z.GetMethod?.IsStatic != true)
                                  .Select(prop => ColumnDataFactory.GetInfo(tableCreationData, prop))
                                  .WhereNotNull()
                                  .OrderBy(z => GetColumnOrder(z))
                                  .ToList();

        tableCreationData.ColumnCreationData.AddRange(columnCreationDatas);
        tableCreationData.BuildMultiForeignKeys();
        return(tableCreationData);
    }