Beispiel #1
0
        public static void Start(string connectionString)
        {
            SchemaBuilder       sb  = new SchemaBuilder(true);
            DynamicQueryManager dqm = new DynamicQueryManager();

            //Connector.Default = new SqlCeConnector(@"Data Source=C:\BaseDatos.sdf", sb.Schema, dqm);

            Connector.Default = new SqlConnector(connectionString, sb.Schema, dqm, SqlServerVersion.SqlServer2008);


            sb.Schema.Version = typeof(MusicStarter).Assembly.GetName().Version;

            sb.Schema.Settings.FieldAttributes((OperationLogEntity ol) => ol.User).Add(new ImplementedByAttribute());
            sb.Schema.Settings.FieldAttributes((ExceptionEntity e) => e.User).Add(new ImplementedByAttribute());

            Validator.PropertyValidator((OperationLogEntity e) => e.User).Validators.Clear();

            TypeLogic.Start(sb, dqm);

            OperationLogic.Start(sb, dqm);
            ExceptionLogic.Start(sb, dqm);

            MusicLogic.Start(sb, dqm);

            sb.Schema.OnSchemaCompleted();
        }
Beispiel #2
0
        public static void Start(string connectionString)
        {
            SchemaBuilder sb = new SchemaBuilder(true);

            //Connector.Default = new SqlCeConnector(@"Data Source=C:\BaseDatos.sdf", sb.Schema);

            var sqlVersion = SqlServerVersionDetector.Detect(connectionString);

            Connector.Default = new SqlConnector(connectionString, sb.Schema, sqlVersion ?? SqlServerVersion.SqlServer2017);

            sb.Schema.Version = typeof(MusicStarter).Assembly.GetName().Version !;

            sb.Schema.Settings.FieldAttributes((OperationLogEntity ol) => ol.User).Add(new ImplementedByAttribute());
            sb.Schema.Settings.FieldAttributes((ExceptionEntity e) => e.User).Add(new ImplementedByAttribute());

            if (Connector.Current.SupportsTemporalTables)
            {
                sb.Schema.Settings.TypeAttributes <FolderEntity>().Add(new SystemVersionedAttribute());
            }

            if (!Schema.Current.Settings.TypeValues.ContainsKey(typeof(TimeSpan)))
            {
                sb.Settings.FieldAttributes((AlbumEntity a) => a.Songs[0].Duration).Add(new Signum.Entities.IgnoreAttribute());
                sb.Settings.FieldAttributes((AlbumEntity a) => a.BonusTrack !.Duration).Add(new Signum.Entities.IgnoreAttribute());
            }

            if (sqlVersion > SqlServerVersion.SqlServer2008)
            {
                sb.Settings.UdtSqlName.Add(typeof(SqlHierarchyId), "HierarchyId");
            }
            else
            {
                sb.Settings.FieldAttributes((LabelEntity a) => a.Node).Add(new Signum.Entities.IgnoreAttribute());
            }

            Validator.PropertyValidator((OperationLogEntity e) => e.User).Validators.Clear();

            TypeLogic.Start(sb);

            OperationLogic.Start(sb);
            ExceptionLogic.Start(sb);

            MusicLogic.Start(sb);

            sb.Schema.OnSchemaCompleted();
        }