示例#1
0
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
            InMemoryDatabase.Initialize();

            WeatherScheduler.ScheduleTaskByMinutes(
                () => {
                Weather florianopolisWeather = repository.getWeatherBy(TimeHelper.convertToUnixTimeStamp(DateTime.Now), InMemoryDatabase.florianopolis);
                Weather curitibaWeather      = repository.getWeatherBy(TimeHelper.convertToUnixTimeStamp(DateTime.Now), InMemoryDatabase.curitiba);
                Weather portoAlegreWeather   = repository.getWeatherBy(TimeHelper.convertToUnixTimeStamp(DateTime.Now), InMemoryDatabase.portoAlegre);
            },
                Interval
                );
        }
示例#2
0
        public void EnterInMemoryMode()
        {
            _inMemory  = true;
            _databases = _metadata.Databases;

            var newDatabases = new Dictionary <String, IDocumentDatabase>();

            foreach (var database in _metadata.Databases)
            {
                var inmemory = new InMemoryDatabase();
                inmemory.Initialize(this);
                newDatabases[database.Key] = inmemory;
            }

            _metadata.Databases = newDatabases;
        }
        public void Use(string mappingMethod, string benefitMappingStrategy)
        {
            MappingType = mappingMethod;

            if (MappingType == Xml)
            {
                DatabaseXml = new InMemoryDatabaseForXmlMappings(IsAddressMappedAsComponent, benefitMappingStrategy);
                DatabaseXml.Initialize();
                SessionXml = DatabaseXml.Session;
            }
            if (MappingType == ByCode)
            {
                databaseByCode = new InMemoryDatabaseForCodeMappings(IsAddressMappedAsComponent, benefitMappingStrategy);
                databaseByCode.Initialize();
                sessionByCode = databaseByCode.Session;
            }
            if (MappingType == Fluent)
            {
                databaseFluent = new InMemoryDatabaseForFluentMappings(IsAddressMappedAsComponent, benefitMappingStrategy);
                databaseFluent.Initialize();
                sessionFluent = databaseFluent.Session;
            }
        }
        public QueryTest()
        {
            Database = new InMemoryDatabase();
            Database.Initialize();

            var johnSmith = new Employee
            {
                Firstname          = "John",
                Lastname           = "Smith",
                DateOfJoining      = new DateTime(2014, 5, 5),
                ResidentialAddress = new Address
                {
                    AddressLine1 = "123 Planet place",
                    AddressLine2 = "12 Gomez street",
                    City         = "London",
                    Postcode     = "SW7 4FG",
                    Country      = "United Kingdom"
                }
            };

            johnSmith.AddCommunity(new Community
            {
                Name = "NHibernate Beginners"
            });
            johnSmith.AddBenefit(new SeasonTicketLoan
            {
                Amount            = 1320,
                MonthlyInstalment = 110
            });
            johnSmith.AddBenefit(new Leave
            {
                AvailableEntitlement = 12,
                RemainingEntitlement = 2
            });

            var hillaryGamble = new Employee
            {
                Firstname          = "hillary",
                Lastname           = "Gamble",
                DateOfJoining      = new DateTime(2013, 5, 5),
                ResidentialAddress = new Address
                {
                    AddressLine1 = "102 Oxygen",
                    AddressLine2 = "34 Western Gateway",
                    City         = "London",
                    Postcode     = "NW5 7AC",
                    Country      = "United Kingdom"
                }
            };

            hillaryGamble.AddCommunity(new Community
            {
                Name = "NHibernate experts"
            });

            hillaryGamble.AddBenefit(new SeasonTicketLoan
            {
                Amount            = 600,
                MonthlyInstalment = 50
            });



            var smithPearson = new Employee
            {
                Firstname          = "Smith",
                Lastname           = "Pearson",
                DateOfJoining      = new DateTime(2013, 5, 5),
                ResidentialAddress = new Address
                {
                    AddressLine1 = "102 Oxygen",
                    AddressLine2 = "34 Western Gateway",
                    City         = "London",
                    Postcode     = "NW5 7AC",
                    Country      = "United Kingdom"
                }
            };

            smithPearson.AddCommunity(new Community
            {
                Name = "NHibernate expers"
            });

            smithPearson.AddBenefit(new SkillsEnhancementAllowance
            {
                Entitlement = 1000
            });

            Database.SeedUsing(new List <Employee>
            {
                johnSmith,
                hillaryGamble,
                smithPearson
            });
        }
示例#5
0
 public InMemoryDatabaseFixture()
 {
     InMemoryDatabase.Initialize();
 }
示例#6
0
 public Startup(IConfiguration configuration)
 {
     Configuration = configuration;
     InMemoryDatabase.Initialize();
 }