Пример #1
0
        private List <string> GetColumnDefinitions()
        {
            List <string> definitions = MetadataResolver.TableColumns <TEntity>()
                                        .Select(c => c.DefinitionForCreateTable())
                                        .ToList();

            List <string> compositeKeys = MetadataResolver.CompositePrimaryKeys <TEntity>();

            if (!compositeKeys.IsNullOrEmpty())
            {
                definitions.Add(
                    $"PRIMARY KEY({string.Join(", ", compositeKeys)})");
            }

            return(definitions);
        }