private void GenerateModulesAndAreas() { if (_dbModel.Driver.Supports(DbFeatures.Schemas)) { // var schemas = _dbSettings.GetSchemas().ToList(); foreach (var schInfo in _dbModel.Schemas) { var sch = schInfo.Schema; // if(schemas.Count > 0 && !schemas.Contains(sch)) // continue; var area = _app.AddArea(sch); var module = new EntityModule(area, "EntityModule" + sch.FirstCap()); } } else { var area = _app.AddArea("Default"); var module = new EntityModule(area, "EntityModuleDefault"); } }
public void TestModuleIntegration() { var schema = "usr"; Startup.DropSchemaObjects(schema); //start from scratch // Runs integrated app by Randy _app = new EntityApp(); var area = _app.AddArea(schema); var persModule = new Bob.PersonModule(area); var loginModule = new Alice.LoginModule(area, typeof(IPersonExt)); // Now replace original entities with new interfaces; // Alice's IUserStub is already replaced by Randy's IPersonExt. _app.ReplaceEntity(typeof(Alice.ILogin), typeof(IAppLogin)); _app.ReplaceEntity(typeof(Bob.IPerson), typeof(IPersonExt)); // activate Startup.ActivateApp(_app); //Test the resulting solution var session = _app.OpenSession(); var pers = session.NewEntity <IPersonExt>(); pers.FirstName = "John"; pers.LastName = "Dow"; pers.BirthDate = new DateTime(1970, 5, 1); pers.Gender = Gender.Male; var login = session.NewEntity <IAppLogin>(); var loginId = login.Id; login.User = pers; login.UserName = "******"; login.FriendlyName = "JohnD"; login.PasswordHash = 123; login.EmployeeNumber = "E111"; session.SaveChanges(); //Let's try to login the user we created using Alice's method session = _app.OpenSession(); var johnLogin = Alice.LoginModule.Login(session, "johnd", 123); var cmd = session.GetLastCommand(); Assert.IsNotNull(johnLogin, "Login failed"); } //method
public void TestModuleIntegration() { var schema = "usr"; SetupHelper.DropSchemaObjects(schema); //start from scratch // Runs integrated app by Randy _app = new EntityApp(); var area = _app.AddArea(schema); var persModule = new Bob.PersonModule(area); var loginModule = new Alice.LoginModule(area, typeof(IPersonExt)); // Now replace original entities with new interfaces; // Alice's IUserStub is already replaced by Randy's IPersonExt. _app.ReplaceEntity(typeof(Alice.ILogin), typeof(IAppLogin)); _app.ReplaceEntity(typeof(Bob.IPerson), typeof(IPersonExt)); // activate SetupHelper.ActivateApp(_app); //Test the resulting solution var session = _app.OpenSession(); var pers = session.NewEntity<IPersonExt>(); pers.FirstName = "John"; pers.LastName = "Dow"; pers.BirthDate = new DateTime(1970, 5, 1); pers.Gender = Gender.Male; var login = session.NewEntity<IAppLogin>(); var loginId = login.Id; login.User = pers; login.UserName = "******"; login.FriendlyName = "JohnD"; login.PasswordHash = 123; login.EmployeeNumber = "E111"; session.SaveChanges(); //Let's try to login the user we created using Alice's method session = _app.OpenSession(); var johnLogin = Alice.LoginModule.Login(session, "johnd", 123); var cmd = session.GetLastCommand(); Assert.IsNotNull(johnLogin, "Login failed"); }