private T createListViewController <T>(PersistentBase currentObject, bool activate, XPObjectSpace XPObjectSpace, HandleInfo handleInfo) where T : ViewController, new() { var controller = createController <T>(currentObject.GetType(), activate, XPObjectSpace, handleInfo); XafApplication application = controller.Application; Isolate.WhenCalled(() => application.CreateObjectSpace()).WillReturn(XPObjectSpace); return(controller); }
private T createDetailViewController <T>(XPObjectSpace XPObjectSpace, PersistentBase currentObject, bool activate, HandleInfo handleInfo) where T : ViewController, new() { XafTypesInfo.Instance.RegisterEntity(currentObject.GetType().BaseType); XafTypesInfo.Instance.RegisterEntity(currentObject.GetType()); XPObjectSpace.Session.UpdateSchema(currentObject.GetType().BaseType); XPObjectSpace.Session.UpdateSchema(currentObject.GetType()); XPObjectSpace.Session.DataLayer.UpdateSchema(true, XPObjectSpace.Session.GetClassInfo(currentObject.GetType().BaseType)); XPObjectSpace.Session.DataLayer.UpdateSchema(true, XPObjectSpace.Session.GetClassInfo(currentObject.GetType())); var application = Isolate.Fake.Instance <XafApplication>(); Isolate.WhenCalled(() => application.CreateObjectSpace()).WillReturn(XPObjectSpace); var detailView = new DetailView(XPObjectSpace, currentObject, application, true); var conntroller = new T(); Isolate.WhenCalled(() => conntroller.Application).WillReturn(application); conntroller.Active[""] = false; conntroller.SetView(detailView); if (activate) { Activate(conntroller, handleInfo); } return(conntroller); }