示例#1
0
        public void ViewMapping_AreEqualTest()
        {
            var model1 = new ViewMapping <TestViewModel1, TestPage1>();
            var model2 = new ViewMapping <TestViewModel1, TestPage1>();

            Assert.Equal(model1, model2);
        }
示例#2
0
        private void RefreshViews(Project project, Connection connection, ref List <string> errors)
        {
            DataTable dataTable  = GetViews(project, connection);
            var       duplicates = FindDuplicates(dataTable, QueryConstants.TableOrView.SchemaName, QueryConstants.TableOrView.Name);

            if (duplicates.Any())
            {
                errors.Add(FormatDuplicates(duplicates));
                return;
            }

            //Add tables to the project
            foreach (DataRow dr in dataTable.Rows)
            {
                string      schemaName;
                string      name;
                ViewMapping vm;

                ExtractTableInfo(dr, out schemaName, out name);
                vm = project.FindViewMapping(connection.Name, schemaName, name);

                if (vm == null)
                {
                    vm = new ViewMapping(connection.Name, schemaName, name, name, null, null, null, null);
                    vm.JoinToProject(project);
                    project.ViewMappings.Add(vm);
                }
                else if (!string.Equals(vm.SchemaName, schemaName))
                {
                    vm.SchemaName = schemaName;
                }
            }

            RemoveNonExistantViews(project, connection, dataTable);
        }
示例#3
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public ViewColumnMapping(
     IProperty property,
     ViewColumn column,
     ViewMapping viewMapping)
     : base(property, column, viewMapping)
 {
 }
示例#4
0
        public void ViewModelViewMappings_DuplicatesExceptionTest()
        {
            var mapper = new ViewModelViewMappings(new TestInitiliser());

            Assert.Equal(0, mapper.Count);

            var model1 = new ViewMapping <TestViewModel1, TestPage1>();
            var model2 = new ViewMapping <TestViewModel1, TestPage2>();

            mapper.AddMapping(model1);
            Assert.True(mapper.ContainsKey <TestViewModel1>());
            Assert.Same(mapper.GetViewType <TestViewModel1>(), typeof(TestPage1));

            Assert.Throws <InvalidOperationException>(() => { mapper.AddMapping(model2); });
        }
示例#5
0
 protected virtual ViewMapping UpdateDataContextInternal(RegionMapping target, GameObject view, ViewMapping viewMapping, object dataContext)
 {
     viewMapping.OnDataContextChange(target, view, viewMapping.DataContext, dataContext);
     viewMapping.DataContext = dataContext;
     return(viewMapping);
 }
示例#6
0
 protected virtual ViewMapping UnlockViewInternal(RegionMapping target, GameObject view, ViewMapping viewMapping)
 {
     view.SetActive(false);             // TODO find a way to lock view and not to hide
     viewMapping.OnViewUnlocked(target, view);
     return(viewMapping);
 }
示例#7
0
 protected virtual ViewMapping ShowViewInternal(RegionMapping target, GameObject view, ViewMapping viewMapping)
 {
     view.SetActive(true);
     viewMapping.OnViewShown(target, view);
     ExecuteShowViewUpdateCommands();
     return(viewMapping);
 }
示例#8
0
 protected virtual ViewMapping HideViewInternal(RegionMapping target, GameObject view, ViewMapping viewMapping)
 {
     view.SetActive(false);
     viewMapping.OnViewHidden(target, view);
     ExecuteHideViewUpdateCommands();
     return(viewMapping);
 }
示例#9
0
 protected virtual ViewMapping UnmapViewInternal(RegionMapping target, GameObject view, ViewMapping viewMapping)
 {
     view.SetActive(false);
     Destroy(view);
     viewMapping.OnViewUnmapped(target, view);
     ExecuteUnmapViewUpdateCommands();
     return(viewMapping);
 }