Esempio n. 1
0
        public void DataObjectCacheSingleMasterTest()
        {
            foreach (IDataService dataService in DataServices)
            {
                // Arrange.
                // Создадим в БД структуру, которая будет служить для проверки.
                Plant2 plant = new Plant2 {
                    Name = "plant"
                };
                Salad2 salad = new Salad2 {
                    Ingridient1 = plant, Ingridient2 = plant
                };
                ICSSoft.STORMNET.DataObject[] objects = { plant, salad };
                dataService.UpdateObjects(ref objects);

                // Подготовим структуру для вычитки.
                LoadingCustomizationStruct lcs = LoadingCustomizationStruct.GetSimpleStruct(typeof(Salad2),
                                                                                            Salad2.Views.Salad2E);
                lcs.ReturnTop = 1;

                // Act.
                ICSSoft.STORMNET.DataObject[] loadedObjects = dataService.LoadObjects(lcs);
                Salad2 actualSalad = (Salad2)loadedObjects[0];

                // Assert.
                Assert.True(actualSalad.Ingridient1.Equals(actualSalad.Ingridient2));
            }
        }
Esempio n. 2
0
        public void TestODataIsOf()
        {
            foreach (IDataService dataService in DataServices)
            {
                ICSSoft.STORMNET.Windows.Forms.ExternalLangDef.LanguageDef.DataService = dataService;
                var    ds   = (SQLDataService)dataService;
                Plant2 cls1 = new Plant2()
                {
                    Name = "n1"
                };
                Cabbage2 cls2 = new Cabbage2()
                {
                    Name = "n2", Type = "type"
                };

                var updateObjectsArray = new ICSSoft.STORMNET.DataObject[] { cls1, cls2 };
                ds.UpdateObjects(ref updateObjectsArray);
                var view = Plant2.Views.Plant2E;

                IQueryable <Plant2> limit;
                //limit = ds.Query<Plant2>(view).Where(it => it.__PrimaryKey != null);

                LoadingCustomizationStruct lcs;

                /*
                 * lcs = LinqToLcs.GetLcs(limit.Expression, view);
                 * lcs.LoadingTypes = new Type[] { typeof(Plant2), typeof(Cabbage2) };
                 * lcs.LoadingTypes = new Type[] { typeof(Cabbage2) };
                 * lcs.View = view;
                 * var list = ds.LoadObjects(lcs);
                 */
                //limit = ds.Query<Plant2>(view).Where(it => typeof(Cabbage2).IsInstanceOfType(it));
                //lcs = LinqToLcs.GetLcs(limit.Expression, view);
                //var list2 = ds.LoadObjects(lcs);
            }
        }