private void InitializeXmlFile() { _rootEntity = new RootEntity { FormDataEntities = new List <FormDataEntity>() }; WriteEntitiesToFile(); }
private void InitializeXmlFile() { _rootEntity = new RootEntity { FileBlobs = new List <FileBlob>() }; WriteEntitiesToFile(); }
public void XSRC_RootEntity_PublicID() { // ARRANGE // Use Test Helpers // ACT IRootEntity entity = TestRootEntity(); // ASSERT entity.PublicId.Should().Be("PublicID"); }
public void XSRC_RootEntity_ContainmentParentID() { // ARRANGE // Use Test Helpers // ACT IRootEntity entity = TestRootEntity(); // ASSERT entity.ContainmentParentId.Should().Be("ContainmentParentID"); }
public void XSRC_RootEntity_Ref() { // ARRANGE // Use Test Helpers // ACT IRootEntity entity = TestRootEntity(); // ASSERT entity.Ref.Should().Be("Ref"); }
public void XSRC_RootEntity_Attribute() { // ARRANGE // Use Test Helpers // ACT IRootEntity entity = TestRootEntity(); // ASSERT entity.EntityAttributes.Should().BeEquivalentTo(TestRootEntityAttributes()); }
public void XSRC_RootEntity_Exists() { // ARRANGE // Use Test Helpers // ACT IRootEntity entity = TestRootEntity(); // ASSERT entity.Should().NotBeNull(); }
protected internal virtual ViewResult NormalPage(ControllerBase controller, IRootEntity rootEntity, NavigateOptions options) { FillViewDataForViewing(controller, rootEntity, options); return(new ViewResult() { ViewName = NormalPageView, MasterName = null, ViewData = controller.ViewData, TempData = controller.TempData }); }
public XmlUnitOfWork(string filename) { if (filename == null) { throw new ArgumentNullException("filename"); } _filename = filename; _xmlSerializer = new XmlSerializer(typeof(RootEntity)); if (!File.Exists(filename)) { InitializeXmlFile(); } using (var streamReader = new StreamReader(filename)) { _rootEntity = (IRootEntity)_xmlSerializer.Deserialize(streamReader); streamReader.Close(); } }
public void FillViewDataForViewing(ControllerBase controller, IRootEntity rootEntity, NavigateOptions options) { TypeContext tc = TypeContextUtilities.UntypedNew(rootEntity, ""); controller.ViewData.Model = tc; var entity = (ModifiableEntity)rootEntity; controller.ViewData[ViewDataKeys.PartialViewName] = options.PartialViewName ?? Navigator.OnPartialViewName(entity); tc.ViewOverrides = Navigator.EntitySettings(entity.GetType()).GetViewOverrides(); if (controller.ViewData[ViewDataKeys.TabId] == null) { controller.ViewData[ViewDataKeys.TabId] = GetOrCreateTabID(controller); } controller.ViewData[ViewDataKeys.ShowOperations] = options.ShowOperations; controller.ViewData[ViewDataKeys.WriteEntityState] = options.WriteEntityState || (bool?)controller.ViewData[ViewDataKeys.WriteEntityState] == true; AssertViewableEntitySettings(entity); tc.ReadOnly = options.ReadOnly ?? Navigator.IsReadOnly(entity); }
public void Dispose() { _xmlSerializer = null; _rootEntity = null; }
public static ViewResult NormalPage(this ControllerBase controller, IRootEntity entity, NavigateOptions options = null) { return(Manager.NormalPage(controller, entity, options ?? new NavigateOptions())); }
public static PartialViewResult PartialView(this ControllerBase controller, IRootEntity entity, string prefix, string partialViewName) { TypeContext tc = TypeContextUtilities.UntypedNew(entity, prefix); return(Manager.PartialView(controller, tc, partialViewName)); }
public static PartialViewResult PopupNavigate(this ControllerBase controller, IRootEntity entity, PopupNavigateOptions options = null) { var prefix = options?.Prefix ?? controller.Prefix(); return(Manager.PopupControl(controller, TypeContextUtilities.UntypedNew(entity, prefix), options ?? new PopupNavigateOptions(prefix))); }
public NavigateOptions(IRootEntity entity) { Entity = entity; ShowOperations = true; }
public static TypeContext UntypedNew(IRootEntity entity, string prefix) { return((TypeContext)Activator.CreateInstance(typeof(TypeContext <>).MakeGenericType(entity.GetType()), entity, prefix)); }