Esempio n. 1
0
        /// <summary>
        /// Gets the schema to use.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        private SqlSchema GetSchema(DatabaseUpdateArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            // mbr - 02-10-2007 - build a search spec...
            GetSchemaArgs schemaArgs = new GetSchemaArgs()
            {
                DatabaseName = args.DatabaseName
            };

            foreach (EntityType et in args.LimitEntityTypes)
            {
                schemaArgs.ConstrainTableNames.Add(et.NativeName.Name);
                schemaArgs.ConstrainTableNames.Add(et.NativeNameExtended.Name);
            }

            // get the schema...
            SqlSchema schema = Database.GetSchema(schemaArgs);

            if (schema == null)
            {
                throw new InvalidOperationException("schema is null.");
            }

            // return...
            return(schema);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the schema for the database.
        /// </summary>
        /// <returns></returns>
        // mbr - 02-10-2007 - added specification.
        protected override SqlSchema CreateSchema(GetSchemaArgs args)
        {
            // base...
            SqlServerInformationSchemaFactory factory = new SqlServerInformationSchemaFactory(this);
            SqlSchema schema = factory.GetSchema(args);

            if (schema == null)
            {
                throw new InvalidOperationException("schema is null.");
            }

            // keys...
            this.SetupKeyColumns(schema);

            // indexes...
            this.AddIndexesToSchema(schema);

            // parents...
            this.AddParentLinks(schema);

            // return...
            return(schema);
        }