src/Shared/EntityFramework.SqlServerCompact/SqlDdlBuilder.cs
// <summary>
// Helper function for generating the scripts for tables &amp; constraints.
// </summary>
Helper function for generating the scripts for tables & constraints.
Helper function for generating the scripts for tables & constraints .
internal static List<string> CreateObjectsScript(StoreItemCollection itemCollection, bool returnWarnings)
        {
            var builder = new SqlDdlBuilder();
            foreach (var container in itemCollection.GetItems<EntityContainer>())
            {
                foreach (var set in container.BaseEntitySets)
                {
                    var entitySet = set as EntitySet;
                    if (entitySet != null)
                    {
                        builder.AppendCreateTable(entitySet);
                    }
                }
                foreach (var set in container.BaseEntitySets)
                {
                    var associationSet = set as AssociationSet;
                    if (associationSet != null)
                    {
                        builder.AppendCreateForeignKeys(associationSet);
                    }
                }
            }
            return builder.GetCommandText(returnWarnings);
        }
internal static List < string > CreateObjectsScript ( StoreItemCollection itemCollection , bool returnWarnings ) { var builder = new SqlDdlBuilder ( ) ; foreach ( var container in itemCollection . GetItems < EntityContainer > ( ) ) { foreach ( var set in container . BaseEntitySets ) { var entitySet = set as EntitySet ; if ( entitySet != null ) { builder . AppendCreateTable ( entitySet ) ; } } foreach ( var set in container . BaseEntitySets ) { var associationSet = set as AssociationSet ; if ( associationSet != null ) { builder . AppendCreateForeignKeys ( associationSet ) ; } } } return builder . GetCommandText ( returnWarnings ) ; }
Helper function for generating the scripts for tables & constraints.
Helper function for generating the scripts for tables & constraints .
// Iterate over the container. // Generate create table statements. // If it is a type of entitySet, generate Create Table statements. // Generate Foreign Key constraints. // If it is association set, generate Foreign Key constraints. // Return the final command text.
itemCollection
StoreItemCollection
returnWarnings
bool