Exemple #1
0
        public static DefaultInitializationDataProvider UseSchema(this DefaultInitializationDataProvider provider, Action <ISchemaBuilder> schemaBuilder)
        {
            var defaultSchemaBuilder = new DefaultSchemaBuilder();

            schemaBuilder.Invoke(defaultSchemaBuilder);
            provider.Schema = defaultSchemaBuilder;
            return(provider);
        }
Exemple #2
0
        public static DefaultInitializationDataProvider UseDataManager(this DefaultInitializationDataProvider provider, DataManagerInitialization dataManager)
        {
            DataManagerValidator validator = new DataManagerValidator(DataManagerValidator.ValidationMode.Insert);

            validator.Validate(dataManager);

            provider.DataManager = dataManager;
            return(provider);
        }
Exemple #3
0
        public static DefaultInitializationDataProvider UseAdministrator(this DefaultInitializationDataProvider provider, AdministratorInitialization administrator)
        {
            ResponsiblePersonValidator validator = new ResponsiblePersonValidator("Administrator", ResponsiblePersonValidator.ValidationMode.Insert);

            validator.Validate(administrator);

            provider.Administrator = administrator;
            return(provider);
        }
Exemple #4
0
        public void Create()
        {
            var builder = new DefaultInitializationDataProvider()
                          .UseDataManager(new DataManagerInitialization()
            {
                Name                           = "SomeCompany",
                Address                        = "Street 1",
                Email                          = "*****@*****.**",
                Phone                          = "123456789",
                RegistrationNumber             = "123",
                PersonalDataRegistrationNumber = "456"
            })
                          .UseAdministrator(new AdministratorInitialization()
            {
                FullName            = "Karel Admin",
                Phone               = "123456789",
                Email               = "*****@*****.**",
                OfficeNumber        = "123",
                InternalPhoneNumber = "456",
                Supervisor          = "Charles Supervisor"
            })
                          .UseConfiguration(new ConfigurationInitialization()
            {
                AllowPurposeChoiceOnAgreementCreation = false
            })
                          .UseSchema((b) =>
            {
                b.AddTable("Persons", tb =>
                {
                    tb.Name        = "Persons table";
                    tb.Description = "Contains personal data of people";
                    tb.AddColumn("FullName", ColumnType.String, false);
                    tb.AddColumn("Phone", ColumnType.String, true);
                });
                b.AddTable("GPSPositions", tb =>
                {
                    tb.Name        = "GPS positions";
                    tb.Description = "Tracking data of people";
                    tb.AddForeignKeyColumn("PersonID", "Persons", false);
                    tb.AddColumn("Latitude", ColumnType.Double, false);
                    tb.AddColumn("Longitude", ColumnType.Double, false);
                });
            });

            var pddb = new PersonalDataDB(new InMemoryDataProvider());

            pddb.CreateDatabase(builder);
        }
Exemple #5
0
 public static DefaultInitializationDataProvider UseConfiguration(this DefaultInitializationDataProvider provider, ConfigurationInitialization configuration)
 {
     provider.Configuration = configuration;
     return(provider);
 }