示例#1
0
        private IEnumerable <CreateTableStatement> GetCreateTableStatements()
        {
            foreach (var entitySet in edmModel.Container.EntitySets)
            {
                ICollection <AssociationType> associationTypes =
                    edmModel.AssociationTypes.Where(a => a.Constraint.ToRole.Name == entitySet.Name).ToList();

                IList <AssociationTypeWrapper> associationTypeWrappers = new List <AssociationTypeWrapper>();
                foreach (var associationType in associationTypes)
                {
                    string fromTable = edmModel.Container.GetEntitySetByName(associationType.Constraint.FromRole.Name, true).Table;
                    string toTable   = edmModel.Container.GetEntitySetByName(associationType.Constraint.ToRole.Name, true).Table;

                    string fromTableName = TableNameCreator.CreateTableName(fromTable);
                    string toTableName   = TableNameCreator.CreateTableName(toTable);

                    associationTypeWrappers.Add(new AssociationTypeWrapper
                    {
                        AssociationType = associationType,
                        FromTableName   = fromTableName,
                        ToTableName     = toTableName
                    });
                }

                var tableStatementBuilder = new CreateTableStatementBuilder(entitySet, associationTypeWrappers);
                yield return(tableStatementBuilder.BuildStatement());
            }
        }
示例#2
0
        private IEnumerable <CreateTableStatement> GetCreateTableStatements()
        {
            var associationTypeContainer = new AssociationTypeContainer(edmModel.AssociationTypes, edmModel.Container);

            foreach (var entitySet in edmModel.Container.EntitySets)
            {
                var tableStatementBuilder = new CreateTableStatementBuilder(entitySet, associationTypeContainer);
                yield return(tableStatementBuilder.BuildStatement());
            }
        }
示例#3
0
        private IEnumerable <CreateTableStatement> GetCreateTableStatements()
        {
            foreach (var entitySet in edmModel.Container.EntitySets)
            {
                ICollection <AssociationType> associationTypes =
                    edmModel.AssociationTypes.Where(a => a.Constraint.ToRole.Name == entitySet.Name).ToList();

                var tableStatementBuilder = new CreateTableStatementBuilder(entitySet, associationTypes);
                yield return(tableStatementBuilder.BuildStatement());
            }
        }