From 5b434b8288f18adfa9ed256a5450183f4a24737a Mon Sep 17 00:00:00 2001 From: tosotova Date: Tue, 13 Feb 2024 10:49:12 +0500 Subject: [PATCH 1/6] Added new objects for tests --- ...tform.Flexberry.ORM.ODataService.Tests.crp | 1156 ++++++++++------- .../SqlScripts/MSSql.create.sql | 621 ++++----- .../SqlScripts/Oracle.create.sql | 644 +++++---- .../SqlScripts/PostgreSql.create.sql | 381 ++++-- Tests/Objects/AgregatorWithSameMAndD.cs | 143 ++ Tests/Objects/DetailAndMaster.cs | 150 +++ Tests/Objects/FirstLevel.cs | 230 ++++ Tests/Objects/SecondLevel1.cs | 150 +++ Tests/Objects/SecondLevel2.cs | 188 +++ Tests/Objects/TestAssociation.cs | 71 + Tests/Objects/TestClass.cs | 106 ++ Tests/Objects/TestConfiguration.cs | 108 ++ Tests/Objects/TestMaster.cs | 30 +- Tests/Objects/ThirdLevel.cs | 150 +++ 14 files changed, 2922 insertions(+), 1206 deletions(-) create mode 100644 Tests/Objects/AgregatorWithSameMAndD.cs create mode 100644 Tests/Objects/DetailAndMaster.cs create mode 100644 Tests/Objects/FirstLevel.cs create mode 100644 Tests/Objects/SecondLevel1.cs create mode 100644 Tests/Objects/SecondLevel2.cs create mode 100644 Tests/Objects/TestAssociation.cs create mode 100644 Tests/Objects/TestClass.cs create mode 100644 Tests/Objects/TestConfiguration.cs create mode 100644 Tests/Objects/ThirdLevel.cs diff --git a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CodeGen/NewPlatform.Flexberry.ORM.ODataService.Tests.crp b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CodeGen/NewPlatform.Flexberry.ORM.ODataService.Tests.crp index ebb6a638..9160c98b 100644 --- a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CodeGen/NewPlatform.Flexberry.ORM.ODataService.Tests.crp +++ b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CodeGen/NewPlatform.Flexberry.ORM.ODataService.Tests.crp @@ -1,1130 +1,1316 @@ - + - - + + + + + + + + + + + + + + + + + - + - + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - + - + - + - + + + + + + + - + + + + - + - - - - + + + + - + - + - + - + - + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + - + - + - + - - + + - + - + - + - - + + - + - + - + - + - - - + + + - + - + - + - - - - - - - - + - + + - + - + + + - + - + - + - - - + + + - + - - + + + - - - + - + - - - - - - - - - - - - - + + - - - - - - + - + - + - - + + - + - + - + - + - + - + - + - + - - - - + + + + - - - - - - - - + - + - - - - - - - + + + + + + + + + + - - - - + - + - + - - + + - + - + - - + + - + - + + + + - + - + - + - + - + - + - - - - - - - - - - - + - - - + - + - - + + - + - + + + + - + - + - + - + - + + + - + - + - - + + - + - + - + + + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + + + - + - - + + - + - + - - + + - + - + - + - + - - + + - + - + - + - + - + - + + + - + - + - + - + - + - + - - + + - + - + - + - + + + + + - + - + - - + + - + - + - + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - + - + - + - - - - - - - - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + + + + + - - - + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + + + + - + - + - + - - + + @@ -1133,15 +1319,15 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/MSSql.create.sql b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/MSSql.create.sql index 672b66b2..738274d8 100644 --- a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/MSSql.create.sql +++ b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/MSSql.create.sql @@ -2,75 +2,59 @@ -CREATE TABLE [Лес] ( +CREATE TABLE [КлассСМножТипов] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Название] VARCHAR(255) NULL, - - [Площадь] INT NULL, - - [Заповедник] BIT NULL, + [PropertyBool] BIT NULL, - [ДатаПослОсмотра] DATETIME NULL, + [PropertyDateTime] DATETIME NULL, - [Страна] UNIQUEIDENTIFIER NULL, + [PropertyDecimal] DECIMAL NULL, - PRIMARY KEY ([primaryKey])) + [PropertyDouble] FLOAT NULL, -CREATE TABLE [КлассСМножТипов] ( + [PropertyEnum] VARCHAR(6) NULL, - [primaryKey] UNIQUEIDENTIFIER NOT NULL, + [PropertyFloat] REAL NULL, [PropertyGeography] geography NULL, - [PropertyEnum] VARCHAR(6) NULL, - - [PropertyBool] BIT NULL, - [PropertyInt] INT NULL, - [PropertyDateTime] DATETIME NULL, - - [PropertyString] VARCHAR(255) NULL, - - [PropertyFloat] REAL NULL, + [PropertyStormnetBlob] NVARCHAR(MAX) NULL, - [PropertyDouble] FLOAT NULL, + [PropertyStormnetContact] NVARCHAR(MAX) NULL, - [PropertyDecimal] DECIMAL NULL, + [PropertyStormnetEvent] NVARCHAR(MAX) NULL, - [PropertySystemNullableDateTime] DATETIME NULL, + [PropertyStormnetFile] NVARCHAR(MAX) NULL, - [PropertySystemNullableInt] INT NULL, + [PropertyStormnetGeoData] NVARCHAR(MAX) NULL, - [PropertySystemNullableGuid] UNIQUEIDENTIFIER NULL, + [PropertyStormnetImage] NVARCHAR(MAX) NULL, - [PropertySystemNullableDecimal] DECIMAL NULL, + [PropertyStormnetKeyGuid] UNIQUEIDENTIFIER NULL, [PropStormnetNullableDateTime] DATETIME NULL, - [PropertyStormnetNullableInt] INT NULL, - - [PropertyStormnetKeyGuid] UNIQUEIDENTIFIER NULL, - [PropStormnetNullableDecimal] DECIMAL NULL, - [PropertyStormnetPartliedDate] VARCHAR(255) NULL, + [PropertyStormnetNullableInt] INT NULL, - [PropertyStormnetContact] NVARCHAR(MAX) NULL, + [PropertyStormnetPartliedDate] VARCHAR(255) NULL, - [PropertyStormnetBlob] NVARCHAR(MAX) NULL, + [PropertyStormnetWebFile] NVARCHAR(MAX) NULL, - [PropertyStormnetEvent] NVARCHAR(MAX) NULL, + [PropertyString] VARCHAR(255) NULL, - [PropertyStormnetGeoData] NVARCHAR(MAX) NULL, + [PropertySystemNullableDateTime] DATETIME NULL, - [PropertyStormnetImage] NVARCHAR(MAX) NULL, + [PropertySystemNullableDecimal] DECIMAL NULL, - [PropertyStormnetWebFile] NVARCHAR(MAX) NULL, + [PropertySystemNullableGuid] UNIQUEIDENTIFIER NULL, - [PropertyStormnetFile] NVARCHAR(MAX) NULL, + [PropertySystemNullableInt] INT NULL, PRIMARY KEY ([primaryKey])) @@ -84,18 +68,35 @@ CREATE TABLE [Master] ( PRIMARY KEY ([primaryKey])) -CREATE TABLE [LegoPatent] ( +CREATE TABLE [Лес] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Name] VARCHAR(255) NULL, + [ДатаПослОсмотра] DATETIME NULL, - [Date] DATETIME NULL, + [Заповедник] BIT NULL, + + [Название] VARCHAR(255) NULL, + + [Площадь] INT NULL, + + [Страна] UNIQUEIDENTIFIER NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [LegoPatent] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, [Authors] VARCHAR(255) NULL, + [Date] DATETIME NULL, + [Description] VARCHAR(255) NULL, + [Name] VARCHAR(255) NULL, + [LegoBlock] UNIQUEIDENTIFIER NULL, [LegoDevice] UNIQUEIDENTIFIER NULL, @@ -193,12 +194,12 @@ CREATE TABLE [Driver] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Name] VARCHAR(255) NULL, - [CarCount] INT NULL, [Documents] BIT NULL, + [Name] VARCHAR(255) NULL, + PRIMARY KEY ([primaryKey])) @@ -226,41 +227,6 @@ CREATE TABLE [Журнал] ( PRIMARY KEY ([primaryKey])) -CREATE TABLE [Медведь] ( - - [primaryKey] UNIQUEIDENTIFIER NOT NULL, - - [ПолеБС] VARCHAR(255) NULL, - - [ПорядковыйНомер] INT NULL, - - [Вес] INT NULL, - - [ЦветГлаз] VARCHAR(255) NULL, - - [Пол] VARCHAR(9) NULL, - - [ДатаРождения] DATETIME NULL, - - [CreateTime] DATETIME NULL, - - [Creator] VARCHAR(255) NULL, - - [EditTime] DATETIME NULL, - - [Editor] VARCHAR(255) NULL, - - [ЛесОбитания] UNIQUEIDENTIFIER NULL, - - [Папа] UNIQUEIDENTIFIER NULL, - - [Страна] UNIQUEIDENTIFIER NULL, - - [Мама] UNIQUEIDENTIFIER NULL, - - PRIMARY KEY ([primaryKey])) - - CREATE TABLE [TestMaster] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, @@ -298,18 +264,18 @@ CREATE TABLE [LegoBlock] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Width] INT NULL, - - [Height] INT NULL, + [Configuration] VARCHAR(255) NULL, [Depth] INT NULL, - [Configuration] VARCHAR(255) NULL, + [Height] INT NULL, - [Name] VARCHAR(255) NULL, + [Width] INT NULL, [BlockId] INT NULL, + [Name] VARCHAR(255) NULL, + [Material] UNIQUEIDENTIFIER NULL, [Color] UNIQUEIDENTIFIER NULL, @@ -317,39 +283,14 @@ CREATE TABLE [LegoBlock] ( PRIMARY KEY ([primaryKey])) -CREATE TABLE [Берлога] ( - - [primaryKey] UNIQUEIDENTIFIER NOT NULL, - - [ПолеБС] VARCHAR(255) NULL, - - [Наименование] VARCHAR(255) NULL, - - [Комфортность] INT NULL, - - [Заброшена] BIT NULL, - - [Сертификат] NVARCHAR(MAX) NULL, - - [CertString] NVARCHAR(MAX) NULL, - - [ЛесРасположения] UNIQUEIDENTIFIER NULL, - - [ДляКакойПороды] UNIQUEIDENTIFIER NULL, - - [Медведь] UNIQUEIDENTIFIER NOT NULL, - - PRIMARY KEY ([primaryKey])) - - CREATE TABLE [LegoBlockColor] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Name] VARCHAR(255) NULL, - [ColorNumber] INT NULL, + [Name] VARCHAR(255) NULL, + PRIMARY KEY ([primaryKey])) @@ -366,10 +307,10 @@ CREATE TABLE [Котенок] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [КличкаКотенка] VARCHAR(255) NULL, - [Глупость] INT NULL, + [КличкаКотенка] VARCHAR(255) NULL, + [Кошка_m0] UNIQUEIDENTIFIER NOT NULL, PRIMARY KEY ([primaryKey])) @@ -412,21 +353,6 @@ CREATE TABLE [DetailsClass1] ( PRIMARY KEY ([primaryKey])) -CREATE TABLE [Car] ( - - [primaryKey] UNIQUEIDENTIFIER NOT NULL, - - [Number] VARCHAR(255) NULL, - - [Model] VARCHAR(255) NULL, - - [TipCar] VARCHAR(9) NULL, - - [driver] UNIQUEIDENTIFIER NOT NULL, - - PRIMARY KEY ([primaryKey])) - - CREATE TABLE [LegoBlockCustomPanel] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, @@ -446,10 +372,10 @@ CREATE TABLE [ТипЛапы] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Название] VARCHAR(255) NULL, - [Актуально] BIT NULL, + [Название] VARCHAR(255) NULL, + PRIMARY KEY ([primaryKey])) @@ -466,10 +392,10 @@ CREATE TABLE [LegoPanelAngle] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Name] VARCHAR(255) NULL, - [Angle] INT NULL, + [Name] VARCHAR(255) NULL, + PRIMARY KEY ([primaryKey])) @@ -548,10 +474,10 @@ CREATE TABLE [ТипПороды] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Название] VARCHAR(255) NULL, - [ДатаРегистрации] DATETIME NULL, + [Название] VARCHAR(255) NULL, + PRIMARY KEY ([primaryKey])) @@ -559,10 +485,10 @@ CREATE TABLE [LegoBlockTopPanel] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [WidthCount] INT NULL, - [HeightCount] INT NULL, + [WidthCount] INT NULL, + [SocketStandard] UNIQUEIDENTIFIER NULL, [Block] UNIQUEIDENTIFIER NOT NULL, @@ -626,10 +552,10 @@ CREATE TABLE [LegoDevice] ( [Electricity] BIT NULL, - [Name] VARCHAR(255) NULL, - [BlockId] INT NULL, + [Name] VARCHAR(255) NULL, + [Color] UNIQUEIDENTIFIER NULL, PRIMARY KEY ([primaryKey])) @@ -645,10 +571,10 @@ CREATE TABLE [Наследник] ( [Свойство2] INT NULL, - [Master] UNIQUEIDENTIFIER NULL, - [Мастер] UNIQUEIDENTIFIER NULL, + [Master] UNIQUEIDENTIFIER NULL, + PRIMARY KEY ([primaryKey])) @@ -656,10 +582,10 @@ CREATE TABLE [LegoBlockBottomPanel] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [WidthCount] INT NULL, - [HeightCount] INT NULL, + [WidthCount] INT NULL, + [Block] UNIQUEIDENTIFIER NOT NULL, PRIMARY KEY ([primaryKey])) @@ -671,55 +597,130 @@ CREATE TABLE [ДочернийКласс] ( [ChildProperty] VARCHAR(255) NULL, - [PropertyGeography] geography NULL, + [PropertyBool] BIT NULL, + + [PropertyDateTime] DATETIME NULL, + + [PropertyDecimal] DECIMAL NULL, + + [PropertyDouble] FLOAT NULL, [PropertyEnum] VARCHAR(6) NULL, - [PropertyBool] BIT NULL, + [PropertyFloat] REAL NULL, + + [PropertyGeography] geography NULL, [PropertyInt] INT NULL, - [PropertyDateTime] DATETIME NULL, + [PropertyStormnetBlob] NVARCHAR(MAX) NULL, - [PropertyString] VARCHAR(255) NULL, + [PropertyStormnetContact] NVARCHAR(MAX) NULL, - [PropertyFloat] REAL NULL, + [PropertyStormnetEvent] NVARCHAR(MAX) NULL, - [PropertyDouble] FLOAT NULL, + [PropertyStormnetFile] NVARCHAR(MAX) NULL, - [PropertyDecimal] DECIMAL NULL, + [PropertyStormnetGeoData] NVARCHAR(MAX) NULL, + + [PropertyStormnetImage] NVARCHAR(MAX) NULL, + + [PropertyStormnetKeyGuid] UNIQUEIDENTIFIER NULL, + + [PropStormnetNullableDateTime] DATETIME NULL, + + [PropStormnetNullableDecimal] DECIMAL NULL, + + [PropertyStormnetNullableInt] INT NULL, + + [PropertyStormnetPartliedDate] VARCHAR(255) NULL, + + [PropertyStormnetWebFile] NVARCHAR(MAX) NULL, + + [PropertyString] VARCHAR(255) NULL, [PropertySystemNullableDateTime] DATETIME NULL, - [PropertySystemNullableInt] INT NULL, + [PropertySystemNullableDecimal] DECIMAL NULL, [PropertySystemNullableGuid] UNIQUEIDENTIFIER NULL, - [PropertySystemNullableDecimal] DECIMAL NULL, + [PropertySystemNullableInt] INT NULL, - [PropStormnetNullableDateTime] DATETIME NULL, + PRIMARY KEY ([primaryKey])) - [PropertyStormnetNullableInt] INT NULL, - [PropertyStormnetKeyGuid] UNIQUEIDENTIFIER NULL, +CREATE TABLE [Медведь] ( - [PropStormnetNullableDecimal] DECIMAL NULL, + [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [PropertyStormnetPartliedDate] VARCHAR(255) NULL, + [Вес] INT NULL, - [PropertyStormnetContact] NVARCHAR(MAX) NULL, + [ДатаРождения] DATETIME NULL, - [PropertyStormnetBlob] NVARCHAR(MAX) NULL, + [Пол] VARCHAR(9) NULL, - [PropertyStormnetEvent] NVARCHAR(MAX) NULL, + [ПолеБС] VARCHAR(255) NULL, - [PropertyStormnetGeoData] NVARCHAR(MAX) NULL, + [ПорядковыйНомер] INT NULL, - [PropertyStormnetImage] NVARCHAR(MAX) NULL, + [ЦветГлаз] VARCHAR(255) NULL, - [PropertyStormnetWebFile] NVARCHAR(MAX) NULL, + [CreateTime] DATETIME NULL, - [PropertyStormnetFile] NVARCHAR(MAX) NULL, + [Creator] VARCHAR(255) NULL, + + [Editor] VARCHAR(255) NULL, + + [EditTime] DATETIME NULL, + + [ЛесОбитания] UNIQUEIDENTIFIER NULL, + + [Мама] UNIQUEIDENTIFIER NULL, + + [Папа] UNIQUEIDENTIFIER NULL, + + [Страна] UNIQUEIDENTIFIER NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [Берлога] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Заброшена] BIT NULL, + + [Комфортность] INT NULL, + + [Наименование] VARCHAR(255) NULL, + + [ПолеБС] VARCHAR(255) NULL, + + [Сертификат] NVARCHAR(MAX) NULL, + + [CertString] NVARCHAR(MAX) NULL, + + [ЛесРасположения] UNIQUEIDENTIFIER NULL, + + [ДляКакойПороды] UNIQUEIDENTIFIER NULL, + + [Медведь] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [Car] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Model] VARCHAR(255) NULL, + + [Number] VARCHAR(255) NULL, + + [TipCar] VARCHAR(9) NULL, + + [driver] UNIQUEIDENTIFIER NOT NULL, PRIMARY KEY ([primaryKey])) @@ -736,27 +737,28 @@ CREATE TABLE [Перелом] ( PRIMARY KEY ([primaryKey])) + CREATE TABLE [Лапа] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Цвет] VARCHAR(255) NULL, - - [Размер] INT NULL, + [БылиЛиПереломы] BIT NULL, [ДатаРождения] DATETIME NULL, - [БылиЛиПереломы] BIT NULL, + [Номер] INT NULL, - [Сторона] VARCHAR(11) NULL, + [Размер] INT NULL, - [Номер] INT NULL, + [РазмерDecimal] DECIMAL NULL, [РазмерDouble] FLOAT NULL, [РазмерFloat] REAL NULL, - [РазмерDecimal] DECIMAL NULL, + [Сторона] VARCHAR(11) NULL, + + [Цвет] VARCHAR(255) NULL, [ТипЛапы_m0] UNIQUEIDENTIFIER NULL, @@ -769,25 +771,132 @@ CREATE TABLE [Кошка] ( [primaryKey] UNIQUEIDENTIFIER NOT NULL, - [Кличка] VARCHAR(255) NULL, + [Агрессивная] BIT NULL, [ДатаРождения] DATETIME NULL, - [Тип] VARCHAR(11) NULL, - - [ПородаСтрокой] VARCHAR(255) NULL, - - [Агрессивная] BIT NULL, + [Кличка] VARCHAR(255) NULL, [УсыСлева] INT NULL, [УсыСправа] INT NULL, + [ПородаСтрокой] VARCHAR(255) NULL, + + [Тип] VARCHAR(11) NULL, + [Порода_m0] UNIQUEIDENTIFIER NOT NULL, PRIMARY KEY ([primaryKey])) +CREATE TABLE [AgregatorWithSameMAndD] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + [Master] UNIQUEIDENTIFIER NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [DetailAndMaster] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + [Agregator] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [TestConfiguration] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [TestClass] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + [FirstLevel] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [ThirdLevel] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + [TestClass] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [SecondLevel1] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + [FirstLevel] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [FirstLevel] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + [TestConfiguration] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [SecondLevel2] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name] VARCHAR(255) NULL, + + [SecondLevel1_m0] UNIQUEIDENTIFIER NULL, + + [SecondLevel1_m1] UNIQUEIDENTIFIER NULL, + + [FirstLevel] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + +CREATE TABLE [TestAssociation] ( + + [primaryKey] UNIQUEIDENTIFIER NOT NULL, + + [Name2] VARCHAR(255) NULL, + + [Name] VARCHAR(255) NULL, + + [SecondLevel1_m0] UNIQUEIDENTIFIER NULL, + + [SecondLevel1_m1] UNIQUEIDENTIFIER NULL, + + [FirstLevel] UNIQUEIDENTIFIER NOT NULL, + + PRIMARY KEY ([primaryKey])) + + CREATE TABLE [STORMNETLOCKDATA] ( [LockKey] VARCHAR(300) NOT NULL, @@ -1069,168 +1178,6 @@ CREATE TABLE [STORMAuField] ( PRIMARY KEY ([primaryKey])) - ALTER TABLE [Лес] ADD CONSTRAINT [Лес_FСтрана_0] FOREIGN KEY ([Страна]) REFERENCES [Страна] -CREATE INDEX Лес_IСтрана on [Лес] ([Страна]) - - ALTER TABLE [LegoPatent] ADD CONSTRAINT [LegoPatent_FLegoBlock_0] FOREIGN KEY ([LegoBlock]) REFERENCES [LegoBlock] -CREATE INDEX LegoPatent_ILegoBlock on [LegoPatent] ([LegoBlock]) - - ALTER TABLE [LegoPatent] ADD CONSTRAINT [LegoPatent_FLegoDevice_0] FOREIGN KEY ([LegoDevice]) REFERENCES [LegoDevice] -CREATE INDEX LegoPatent_ILegoDevice on [LegoPatent] ([LegoDevice]) - - ALTER TABLE [Мастер] ADD CONSTRAINT [Мастер_FМастер2_0] FOREIGN KEY ([Мастер2]) REFERENCES [Мастер2] -CREATE INDEX Мастер_IМастер2 on [Мастер] ([Мастер2]) - - ALTER TABLE [Блоха] ADD CONSTRAINT [Блоха_FМедведь_0] FOREIGN KEY ([МедведьОбитания]) REFERENCES [Медведь] -CREATE INDEX Блоха_IМедведьОбитания on [Блоха] ([МедведьОбитания]) - - ALTER TABLE [TestDetailWithCicle] ADD CONSTRAINT [TestDetailWithCicle_FTestDetailWithCicle_0] FOREIGN KEY ([Parent]) REFERENCES [TestDetailWithCicle] -CREATE INDEX TestDetailWithCicle_IParent on [TestDetailWithCicle] ([Parent]) - - ALTER TABLE [TestDetailWithCicle] ADD CONSTRAINT [TestDetailWithCicle_FTestMaster_0] FOREIGN KEY ([TestMaster]) REFERENCES [TestMaster] -CREATE INDEX TestDetailWithCicle_ITestMaster on [TestDetailWithCicle] ([TestMaster]) - - ALTER TABLE [Детейл] ADD CONSTRAINT [Детейл_FБазовыйКласс_0] FOREIGN KEY ([БазовыйКласс_m0]) REFERENCES [БазовыйКласс] -CREATE INDEX Детейл_IБазовыйКласс_m0 on [Детейл] ([БазовыйКласс_m0]) - - ALTER TABLE [Детейл] ADD CONSTRAINT [Детейл_FНаследник_0] FOREIGN KEY ([БазовыйКласс_m1]) REFERENCES [Наследник] -CREATE INDEX Детейл_IБазовыйКласс_m1 on [Детейл] ([БазовыйКласс_m1]) - - ALTER TABLE [Журнал] ADD CONSTRAINT [Журнал_FАвтор_0] FOREIGN KEY ([Автор2]) REFERENCES [Автор] -CREATE INDEX Журнал_IАвтор2 on [Журнал] ([Автор2]) - - ALTER TABLE [Журнал] ADD CONSTRAINT [Журнал_FБиблиотека_0] FOREIGN KEY ([Библиотека2]) REFERENCES [Библиотека] -CREATE INDEX Журнал_IБиблиотека2 on [Журнал] ([Библиотека2]) - - ALTER TABLE [Медведь] ADD CONSTRAINT [Медведь_FЛес_0] FOREIGN KEY ([ЛесОбитания]) REFERENCES [Лес] -CREATE INDEX Медведь_IЛесОбитания on [Медведь] ([ЛесОбитания]) - - ALTER TABLE [Медведь] ADD CONSTRAINT [Медведь_FМедведь_0] FOREIGN KEY ([Папа]) REFERENCES [Медведь] -CREATE INDEX Медведь_IПапа on [Медведь] ([Папа]) - - ALTER TABLE [Медведь] ADD CONSTRAINT [Медведь_FСтрана_0] FOREIGN KEY ([Страна]) REFERENCES [Страна] -CREATE INDEX Медведь_IСтрана on [Медведь] ([Страна]) - - ALTER TABLE [Медведь] ADD CONSTRAINT [Медведь_FМедведь_1] FOREIGN KEY ([Мама]) REFERENCES [Медведь] -CREATE INDEX Медведь_IМама on [Медведь] ([Мама]) - - ALTER TABLE [MainClass] ADD CONSTRAINT [MainClass_FAgrClass1_0] FOREIGN KEY ([AgrClass1]) REFERENCES [AgrClass1] -CREATE INDEX MainClass_IAgrClass1 on [MainClass] ([AgrClass1]) - - ALTER TABLE [Порода] ADD CONSTRAINT [Порода_FПорода_0] FOREIGN KEY ([Иерархия_m0]) REFERENCES [Порода] -CREATE INDEX Порода_IИерархия_m0 on [Порода] ([Иерархия_m0]) - - ALTER TABLE [Порода] ADD CONSTRAINT [Порода_FТипПороды_0] FOREIGN KEY ([ТипПороды_m0]) REFERENCES [ТипПороды] -CREATE INDEX Порода_IТипПороды_m0 on [Порода] ([ТипПороды_m0]) - - ALTER TABLE [LegoBlock] ADD CONSTRAINT [LegoBlock_FLegoMaterial_0] FOREIGN KEY ([Material]) REFERENCES [LegoMaterial] -CREATE INDEX LegoBlock_IMaterial on [LegoBlock] ([Material]) - - ALTER TABLE [LegoBlock] ADD CONSTRAINT [LegoBlock_FLegoBlockColor_0] FOREIGN KEY ([Color]) REFERENCES [LegoBlockColor] -CREATE INDEX LegoBlock_IColor on [LegoBlock] ([Color]) - - ALTER TABLE [Берлога] ADD CONSTRAINT [Берлога_FЛес_0] FOREIGN KEY ([ЛесРасположения]) REFERENCES [Лес] -CREATE INDEX Берлога_IЛесРасположения on [Берлога] ([ЛесРасположения]) - - ALTER TABLE [Берлога] ADD CONSTRAINT [Берлога_FПорода_0] FOREIGN KEY ([ДляКакойПороды]) REFERENCES [Порода] -CREATE INDEX Берлога_IДляКакойПороды on [Берлога] ([ДляКакойПороды]) - - ALTER TABLE [Берлога] ADD CONSTRAINT [Берлога_FМедведь_0] FOREIGN KEY ([Медведь]) REFERENCES [Медведь] -CREATE INDEX Берлога_IМедведь on [Берлога] ([Медведь]) - - ALTER TABLE [Котенок] ADD CONSTRAINT [Котенок_FКошка_0] FOREIGN KEY ([Кошка_m0]) REFERENCES [Кошка] -CREATE INDEX Котенок_IКошка_m0 on [Котенок] ([Кошка_m0]) - - ALTER TABLE [Daughter] ADD CONSTRAINT [Daughter_FPerson_0] FOREIGN KEY ([Parent]) REFERENCES [Person] -CREATE INDEX Daughter_IParent on [Daughter] ([Parent]) - - ALTER TABLE [LegoBlockTopPanelHole] ADD CONSTRAINT [LegoBlockTopPanelHole_FLegoBlockTopPanel_0] FOREIGN KEY ([TopPanel]) REFERENCES [LegoBlockTopPanel] -CREATE INDEX LegoBlockTopPanelHole_ITopPanel on [LegoBlockTopPanelHole] ([TopPanel]) - - ALTER TABLE [DetailsClass1] ADD CONSTRAINT [DetailsClass1_FDetailsClass2_0] FOREIGN KEY ([DetailsClass2]) REFERENCES [DetailsClass2] -CREATE INDEX DetailsClass1_IDetailsClass2 on [DetailsClass1] ([DetailsClass2]) - - ALTER TABLE [DetailsClass1] ADD CONSTRAINT [DetailsClass1_FAgrClass1_0] FOREIGN KEY ([AgrClass1]) REFERENCES [AgrClass1] -CREATE INDEX DetailsClass1_IAgrClass1 on [DetailsClass1] ([AgrClass1]) - - ALTER TABLE [Car] ADD CONSTRAINT [Car_FDriver_0] FOREIGN KEY ([driver]) REFERENCES [Driver] -CREATE INDEX Car_Idriver on [Car] ([driver]) - - ALTER TABLE [LegoBlockCustomPanel] ADD CONSTRAINT [LegoBlockCustomPanel_FLegoPanelAngle_0] FOREIGN KEY ([PanelAngle]) REFERENCES [LegoPanelAngle] -CREATE INDEX LegoBlockCustomPanel_IPanelAngle on [LegoBlockCustomPanel] ([PanelAngle]) - - ALTER TABLE [LegoBlockCustomPanel] ADD CONSTRAINT [LegoBlockCustomPanel_FLegoBlock_0] FOREIGN KEY ([Block]) REFERENCES [LegoBlock] -CREATE INDEX LegoBlockCustomPanel_IBlock on [LegoBlockCustomPanel] ([Block]) - - ALTER TABLE [Детейл2] ADD CONSTRAINT [Детейл2_FДетейл_0] FOREIGN KEY ([Детейл_m0]) REFERENCES [Детейл] -CREATE INDEX Детейл2_IДетейл_m0 on [Детейл2] ([Детейл_m0]) - - ALTER TABLE [Детейл2] ADD CONSTRAINT [Детейл2_FДетейлНаследник_0] FOREIGN KEY ([Детейл_m1]) REFERENCES [ДетейлНаследник] -CREATE INDEX Детейл2_IДетейл_m1 on [Детейл2] ([Детейл_m1]) - - ALTER TABLE [Son] ADD CONSTRAINT [Son_FPerson_0] FOREIGN KEY ([Parent]) REFERENCES [Person] -CREATE INDEX Son_IParent on [Son] ([Parent]) - - ALTER TABLE [LegoBlockTopPanel] ADD CONSTRAINT [LegoBlockTopPanel_FLegoSocketStandard_0] FOREIGN KEY ([SocketStandard]) REFERENCES [LegoSocketStandard] -CREATE INDEX LegoBlockTopPanel_ISocketStandard on [LegoBlockTopPanel] ([SocketStandard]) - - ALTER TABLE [LegoBlockTopPanel] ADD CONSTRAINT [LegoBlockTopPanel_FLegoBlock_0] FOREIGN KEY ([Block]) REFERENCES [LegoBlock] -CREATE INDEX LegoBlockTopPanel_IBlock on [LegoBlockTopPanel] ([Block]) - - ALTER TABLE [ДетейлНаследник] ADD CONSTRAINT [ДетейлНаследник_FБазовыйКласс_0] FOREIGN KEY ([БазовыйКласс_m0]) REFERENCES [БазовыйКласс] -CREATE INDEX ДетейлНаследник_IБазовыйКласс_m0 on [ДетейлНаследник] ([БазовыйКласс_m0]) - - ALTER TABLE [ДетейлНаследник] ADD CONSTRAINT [ДетейлНаследник_FНаследник_0] FOREIGN KEY ([БазовыйКласс_m1]) REFERENCES [Наследник] -CREATE INDEX ДетейлНаследник_IБазовыйКласс_m1 on [ДетейлНаследник] ([БазовыйКласс_m1]) - - ALTER TABLE [DetailsClass2] ADD CONSTRAINT [DetailsClass2_FAgrClass2_0] FOREIGN KEY ([AgrClass2]) REFERENCES [AgrClass2] -CREATE INDEX DetailsClass2_IAgrClass2 on [DetailsClass2] ([AgrClass2]) - - ALTER TABLE [Книга] ADD CONSTRAINT [Книга_FАвтор_0] FOREIGN KEY ([Автор1]) REFERENCES [Автор] -CREATE INDEX Книга_IАвтор1 on [Книга] ([Автор1]) - - ALTER TABLE [Книга] ADD CONSTRAINT [Книга_FБиблиотека_0] FOREIGN KEY ([Библиотека1]) REFERENCES [Библиотека] -CREATE INDEX Книга_IБиблиотека1 on [Книга] ([Библиотека1]) - - ALTER TABLE [LegoDevice] ADD CONSTRAINT [LegoDevice_FLegoBlockColor_0] FOREIGN KEY ([Color]) REFERENCES [LegoBlockColor] -CREATE INDEX LegoDevice_IColor on [LegoDevice] ([Color]) - - ALTER TABLE [Наследник] ADD CONSTRAINT [Наследник_FMaster_0] FOREIGN KEY ([Master]) REFERENCES [Master] -CREATE INDEX Наследник_IMaster on [Наследник] ([Master]) - - ALTER TABLE [Наследник] ADD CONSTRAINT [Наследник_FМастер_0] FOREIGN KEY ([Мастер]) REFERENCES [Мастер] -CREATE INDEX Наследник_IМастер on [Наследник] ([Мастер]) - - ALTER TABLE [LegoBlockBottomPanel] ADD CONSTRAINT [LegoBlockBottomPanel_FLegoBlock_0] FOREIGN KEY ([Block]) REFERENCES [LegoBlock] -CREATE INDEX LegoBlockBottomPanel_IBlock on [LegoBlockBottomPanel] ([Block]) - - ALTER TABLE [Перелом] ADD CONSTRAINT [Перелом_FЛапа_0] FOREIGN KEY ([Лапа_m0]) REFERENCES [Лапа] -CREATE INDEX Перелом_IЛапа_m0 on [Перелом] ([Лапа_m0]) - - ALTER TABLE [Лапа] ADD CONSTRAINT [Лапа_FТипЛапы_0] FOREIGN KEY ([ТипЛапы_m0]) REFERENCES [ТипЛапы] -CREATE INDEX Лапа_IТипЛапы_m0 on [Лапа] ([ТипЛапы_m0]) - - ALTER TABLE [Лапа] ADD CONSTRAINT [Лапа_FКошка_0] FOREIGN KEY ([Кошка_m0]) REFERENCES [Кошка] -CREATE INDEX Лапа_IКошка_m0 on [Лапа] ([Кошка_m0]) - - ALTER TABLE [Кошка] ADD CONSTRAINT [Кошка_FПорода_0] FOREIGN KEY ([Порода_m0]) REFERENCES [Порода] -CREATE INDEX Кошка_IПорода_m0 on [Кошка] ([Порода_m0]) - - ALTER TABLE [STORMWEBSEARCH] ADD CONSTRAINT [STORMWEBSEARCH_FSTORMFILTERSETTING_0] FOREIGN KEY ([FilterSetting_m0]) REFERENCES [STORMFILTERSETTING] - - ALTER TABLE [STORMFILTERDETAIL] ADD CONSTRAINT [STORMFILTERDETAIL_FSTORMFILTERSETTING_0] FOREIGN KEY ([FilterSetting_m0]) REFERENCES [STORMFILTERSETTING] - - ALTER TABLE [STORMFILTERLOOKUP] ADD CONSTRAINT [STORMFILTERLOOKUP_FSTORMFILTERSETTING_0] FOREIGN KEY ([FilterSetting_m0]) REFERENCES [STORMFILTERSETTING] - - ALTER TABLE [STORMLG] ADD CONSTRAINT [STORMLG_FSTORMAG_0] FOREIGN KEY ([Group_m0]) REFERENCES [STORMAG] - - ALTER TABLE [STORMLG] ADD CONSTRAINT [STORMLG_FSTORMAG_1] FOREIGN KEY ([User_m0]) REFERENCES [STORMAG] - - ALTER TABLE [STORMAuEntity] ADD CONSTRAINT [STORMAuEntity_FSTORMAG_0] FOREIGN KEY ([User_m0]) REFERENCES [STORMAG] - - ALTER TABLE [STORMAuEntity] ADD CONSTRAINT [STORMAuEntity_FSTORMAuObjType_0] FOREIGN KEY ([ObjectType_m0]) REFERENCES [STORMAuObjType] - ALTER TABLE [STORMAuField] ADD CONSTRAINT [STORMAuField_FSTORMAuField_0] FOREIGN KEY ([MainChange_m0]) REFERENCES [STORMAuField] - ALTER TABLE [STORMAuField] ADD CONSTRAINT [STORMAuField_FSTORMAuEntity_0] FOREIGN KEY ([AuditEntity_m0]) REFERENCES [STORMAuEntity] diff --git a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/Oracle.create.sql b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/Oracle.create.sql index 6f1691e3..94a39ba0 100644 --- a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/Oracle.create.sql +++ b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/Oracle.create.sql @@ -2,78 +2,60 @@ -CREATE TABLE "Лес" +CREATE TABLE "КлассСМножТипов" ( "primaryKey" RAW(16) NOT NULL, - "Название" NVARCHAR2(255) NULL, - - "Площадь" NUMBER(10) NULL, - - "Заповедник" NUMBER(1) NULL, + "PropertyBool" NUMBER(1) NULL, - "ДатаПослОсмотра" DATE NULL, + "PropertyDateTime" DATE NULL, - "Страна" RAW(16) NULL, + "PropertyDecimal" NUMBER(38) NULL, - PRIMARY KEY ("primaryKey") -) ; + "PropertyDouble" FLOAT(126) NULL, -CREATE TABLE "КлассСМножТипов" -( + "PropertyEnum" NVARCHAR2(6) NULL, - "primaryKey" RAW(16) NOT NULL, + "PropertyFloat" FLOAT(53) NULL, "PropertyGeography" CLOB NULL, - "PropertyEnum" NVARCHAR2(6) NULL, - - "PropertyBool" NUMBER(1) NULL, - "PropertyInt" NUMBER(10) NULL, - "PropertyDateTime" DATE NULL, - - "PropertyString" NVARCHAR2(255) NULL, - - "PropertyFloat" FLOAT(53) NULL, + "PropertyStormnetBlob" CLOB NULL, - "PropertyDouble" FLOAT(126) NULL, + "PropertyStormnetContact" CLOB NULL, - "PropertyDecimal" NUMBER(38) NULL, + "PropertyStormnetEvent" CLOB NULL, - "PropertySystemNullableDateTime" DATE NULL, + "PropertyStormnetFile" CLOB NULL, - "PropertySystemNullableInt" NUMBER(10) NULL, + "PropertyStormnetGeoData" CLOB NULL, - "PropertySystemNullableGuid" RAW(16) NULL, + "PropertyStormnetImage" CLOB NULL, - "PropertySystemNullableDecimal" NUMBER(38) NULL, + "PropertyStormnetKeyGuid" RAW(16) NULL, "PropStormnetNullableDateTime" DATE NULL, - "PropertyStormnetNullableInt" NUMBER(10) NULL, - - "PropertyStormnetKeyGuid" RAW(16) NULL, - "PropStormnetNullableDecimal" NUMBER(38) NULL, - "PropertyStormnetPartliedDate" NVARCHAR2(255) NULL, + "PropertyStormnetNullableInt" NUMBER(10) NULL, - "PropertyStormnetContact" CLOB NULL, + "PropertyStormnetPartliedDate" NVARCHAR2(255) NULL, - "PropertyStormnetBlob" CLOB NULL, + "PropertyStormnetWebFile" CLOB NULL, - "PropertyStormnetEvent" CLOB NULL, + "PropertyString" NVARCHAR2(255) NULL, - "PropertyStormnetGeoData" CLOB NULL, + "PropertySystemNullableDateTime" DATE NULL, - "PropertyStormnetImage" CLOB NULL, + "PropertySystemNullableDecimal" NUMBER(38) NULL, - "PropertyStormnetWebFile" CLOB NULL, + "PropertySystemNullableGuid" RAW(16) NULL, - "PropertyStormnetFile" CLOB NULL, + "PropertySystemNullableInt" NUMBER(10) NULL, PRIMARY KEY ("primaryKey") ) ; @@ -90,19 +72,38 @@ CREATE TABLE "Master" ) ; -CREATE TABLE "LegoPatent" +CREATE TABLE "Лес" ( "primaryKey" RAW(16) NOT NULL, - "Name" NVARCHAR2(255) NULL, + "ДатаПослОсмотра" DATE NULL, - "Date" DATE NULL, + "Заповедник" NUMBER(1) NULL, + + "Название" NVARCHAR2(255) NULL, + + "Площадь" NUMBER(10) NULL, + + "Страна" RAW(16) NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "LegoPatent" +( + + "primaryKey" RAW(16) NOT NULL, "Authors" NVARCHAR2(255) NULL, + "Date" DATE NULL, + "Description" NVARCHAR2(255) NULL, + "Name" NVARCHAR2(255) NULL, + "LegoBlock" RAW(16) NULL, "LegoDevice" RAW(16) NULL, @@ -218,12 +219,12 @@ CREATE TABLE "Driver" "primaryKey" RAW(16) NOT NULL, - "Name" NVARCHAR2(255) NULL, - "CarCount" NUMBER(10) NULL, "Documents" NUMBER(1) NULL, + "Name" NVARCHAR2(255) NULL, + PRIMARY KEY ("primaryKey") ) ; @@ -256,43 +257,6 @@ CREATE TABLE "Журнал" ) ; -CREATE TABLE "Медведь" -( - - "primaryKey" RAW(16) NOT NULL, - - "ПолеБС" NVARCHAR2(255) NULL, - - "ПорядковыйНомер" NUMBER(10) NULL, - - "Вес" NUMBER(10) NULL, - - "ЦветГлаз" NVARCHAR2(255) NULL, - - "Пол" NVARCHAR2(9) NULL, - - "ДатаРождения" DATE NULL, - - "CreateTime" DATE NULL, - - "Creator" NVARCHAR2(255) NULL, - - "EditTime" DATE NULL, - - "Editor" NVARCHAR2(255) NULL, - - "ЛесОбитания" RAW(16) NULL, - - "Папа" RAW(16) NULL, - - "Страна" RAW(16) NULL, - - "Мама" RAW(16) NULL, - - PRIMARY KEY ("primaryKey") -) ; - - CREATE TABLE "TestMaster" ( @@ -337,18 +301,18 @@ CREATE TABLE "LegoBlock" "primaryKey" RAW(16) NOT NULL, - "Width" NUMBER(10) NULL, - - "Height" NUMBER(10) NULL, + "Configuration" NVARCHAR2(255) NULL, "Depth" NUMBER(10) NULL, - "Configuration" NVARCHAR2(255) NULL, + "Height" NUMBER(10) NULL, - "Name" NVARCHAR2(255) NULL, + "Width" NUMBER(10) NULL, "BlockId" NUMBER(10) NULL, + "Name" NVARCHAR2(255) NULL, + "Material" RAW(16) NULL, "Color" RAW(16) NULL, @@ -357,42 +321,15 @@ CREATE TABLE "LegoBlock" ) ; -CREATE TABLE "Берлога" -( - - "primaryKey" RAW(16) NOT NULL, - - "ПолеБС" NVARCHAR2(255) NULL, - - "Наименование" NVARCHAR2(255) NULL, - - "Комфортность" NUMBER(10) NULL, - - "Заброшена" NUMBER(1) NULL, - - "Сертификат" CLOB NULL, - - "CertString" CLOB NULL, - - "ЛесРасположения" RAW(16) NULL, - - "ДляКакойПороды" RAW(16) NULL, - - "Медведь" RAW(16) NOT NULL, - - PRIMARY KEY ("primaryKey") -) ; - - CREATE TABLE "LegoBlockColor" ( "primaryKey" RAW(16) NOT NULL, - "Name" NVARCHAR2(255) NULL, - "ColorNumber" NUMBER(10) NULL, + "Name" NVARCHAR2(255) NULL, + PRIMARY KEY ("primaryKey") ) ; @@ -413,10 +350,10 @@ CREATE TABLE "Котенок" "primaryKey" RAW(16) NOT NULL, - "КличкаКотенка" NVARCHAR2(255) NULL, - "Глупость" NUMBER(10) NULL, + "КличкаКотенка" NVARCHAR2(255) NULL, + "Кошка_m0" RAW(16) NOT NULL, PRIMARY KEY ("primaryKey") @@ -466,23 +403,6 @@ CREATE TABLE "DetailsClass1" ) ; -CREATE TABLE "Car" -( - - "primaryKey" RAW(16) NOT NULL, - - "Number" NVARCHAR2(255) NULL, - - "Model" NVARCHAR2(255) NULL, - - "TipCar" NVARCHAR2(9) NULL, - - "driver" RAW(16) NOT NULL, - - PRIMARY KEY ("primaryKey") -) ; - - CREATE TABLE "LegoBlockCustomPanel" ( @@ -505,10 +425,10 @@ CREATE TABLE "ТипЛапы" "primaryKey" RAW(16) NOT NULL, - "Название" NVARCHAR2(255) NULL, - "Актуально" NUMBER(1) NULL, + "Название" NVARCHAR2(255) NULL, + PRIMARY KEY ("primaryKey") ) ; @@ -529,10 +449,10 @@ CREATE TABLE "LegoPanelAngle" "primaryKey" RAW(16) NOT NULL, - "Name" NVARCHAR2(255) NULL, - "Angle" NUMBER(10) NULL, + "Name" NVARCHAR2(255) NULL, + PRIMARY KEY ("primaryKey") ) ; @@ -627,10 +547,10 @@ CREATE TABLE "ТипПороды" "primaryKey" RAW(16) NOT NULL, - "Название" NVARCHAR2(255) NULL, - "ДатаРегистрации" DATE NULL, + "Название" NVARCHAR2(255) NULL, + PRIMARY KEY ("primaryKey") ) ; @@ -640,10 +560,10 @@ CREATE TABLE "LegoBlockTopPanel" "primaryKey" RAW(16) NOT NULL, - "WidthCount" NUMBER(10) NULL, - "HeightCount" NUMBER(10) NULL, + "WidthCount" NUMBER(10) NULL, + "SocketStandard" RAW(16) NULL, "Block" RAW(16) NOT NULL, @@ -717,10 +637,10 @@ CREATE TABLE "LegoDevice" "Electricity" NUMBER(1) NULL, - "Name" NVARCHAR2(255) NULL, - "BlockId" NUMBER(10) NULL, + "Name" NVARCHAR2(255) NULL, + "Color" RAW(16) NULL, PRIMARY KEY ("primaryKey") @@ -738,10 +658,10 @@ CREATE TABLE "Наследник" "Свойство2" NUMBER(10) NULL, - "Master" RAW(16) NULL, - "Мастер" RAW(16) NULL, + "Master" RAW(16) NULL, + PRIMARY KEY ("primaryKey") ) ; @@ -751,10 +671,10 @@ CREATE TABLE "LegoBlockBottomPanel" "primaryKey" RAW(16) NOT NULL, - "WidthCount" NUMBER(10) NULL, - "HeightCount" NUMBER(10) NULL, + "WidthCount" NUMBER(10) NULL, + "Block" RAW(16) NOT NULL, PRIMARY KEY ("primaryKey") @@ -768,55 +688,136 @@ CREATE TABLE "ДочернийКласс" "ChildProperty" NVARCHAR2(255) NULL, - "PropertyGeography" CLOB NULL, - - "PropertyEnum" NVARCHAR2(6) NULL, - "PropertyBool" NUMBER(1) NULL, - "PropertyInt" NUMBER(10) NULL, - "PropertyDateTime" DATE NULL, - "PropertyString" NVARCHAR2(255) NULL, + "PropertyDecimal" NUMBER(38) NULL, + + "PropertyDouble" FLOAT(126) NULL, + + "PropertyEnum" NVARCHAR2(6) NULL, "PropertyFloat" FLOAT(53) NULL, - "PropertyDouble" FLOAT(126) NULL, + "PropertyGeography" CLOB NULL, - "PropertyDecimal" NUMBER(38) NULL, + "PropertyInt" NUMBER(10) NULL, - "PropertySystemNullableDateTime" DATE NULL, + "PropertyStormnetBlob" CLOB NULL, - "PropertySystemNullableInt" NUMBER(10) NULL, + "PropertyStormnetContact" CLOB NULL, - "PropertySystemNullableGuid" RAW(16) NULL, + "PropertyStormnetEvent" CLOB NULL, - "PropertySystemNullableDecimal" NUMBER(38) NULL, + "PropertyStormnetFile" CLOB NULL, - "PropStormnetNullableDateTime" DATE NULL, + "PropertyStormnetGeoData" CLOB NULL, - "PropertyStormnetNullableInt" NUMBER(10) NULL, + "PropertyStormnetImage" CLOB NULL, "PropertyStormnetKeyGuid" RAW(16) NULL, + "PropStormnetNullableDateTime" DATE NULL, + "PropStormnetNullableDecimal" NUMBER(38) NULL, + "PropertyStormnetNullableInt" NUMBER(10) NULL, + "PropertyStormnetPartliedDate" NVARCHAR2(255) NULL, - "PropertyStormnetContact" CLOB NULL, + "PropertyStormnetWebFile" CLOB NULL, - "PropertyStormnetBlob" CLOB NULL, + "PropertyString" NVARCHAR2(255) NULL, - "PropertyStormnetEvent" CLOB NULL, + "PropertySystemNullableDateTime" DATE NULL, - "PropertyStormnetGeoData" CLOB NULL, + "PropertySystemNullableDecimal" NUMBER(38) NULL, - "PropertyStormnetImage" CLOB NULL, + "PropertySystemNullableGuid" RAW(16) NULL, - "PropertyStormnetWebFile" CLOB NULL, + "PropertySystemNullableInt" NUMBER(10) NULL, - "PropertyStormnetFile" CLOB NULL, + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "Медведь" +( + + "primaryKey" RAW(16) NOT NULL, + + "Вес" NUMBER(10) NULL, + + "ДатаРождения" DATE NULL, + + "Пол" NVARCHAR2(9) NULL, + + "ПолеБС" NVARCHAR2(255) NULL, + + "ПорядковыйНомер" NUMBER(10) NULL, + + "ЦветГлаз" NVARCHAR2(255) NULL, + + "CreateTime" DATE NULL, + + "Creator" NVARCHAR2(255) NULL, + + "Editor" NVARCHAR2(255) NULL, + + "EditTime" DATE NULL, + + "ЛесОбитания" RAW(16) NULL, + + "Мама" RAW(16) NULL, + + "Папа" RAW(16) NULL, + + "Страна" RAW(16) NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "Берлога" +( + + "primaryKey" RAW(16) NOT NULL, + + "Заброшена" NUMBER(1) NULL, + + "Комфортность" NUMBER(10) NULL, + + "Наименование" NVARCHAR2(255) NULL, + + "ПолеБС" NVARCHAR2(255) NULL, + + "Сертификат" CLOB NULL, + + "CertString" CLOB NULL, + + "ЛесРасположения" RAW(16) NULL, + + "ДляКакойПороды" RAW(16) NULL, + + "Медведь" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "Car" +( + + "primaryKey" RAW(16) NOT NULL, + + "Model" NVARCHAR2(255) NULL, + + "Number" NVARCHAR2(255) NULL, + + "TipCar" NVARCHAR2(9) NULL, + + "driver" RAW(16) NOT NULL, PRIMARY KEY ("primaryKey") ) ; @@ -836,28 +837,29 @@ CREATE TABLE "Перелом" PRIMARY KEY ("primaryKey") ) ; + CREATE TABLE "Лапа" ( "primaryKey" RAW(16) NOT NULL, - "Цвет" NVARCHAR2(255) NULL, - - "Размер" NUMBER(10) NULL, + "БылиЛиПереломы" NUMBER(1) NULL, "ДатаРождения" DATE NULL, - "БылиЛиПереломы" NUMBER(1) NULL, + "Номер" NUMBER(10) NULL, - "Сторона" NVARCHAR2(11) NULL, + "Размер" NUMBER(10) NULL, - "Номер" NUMBER(10) NULL, + "РазмерDecimal" NUMBER(38) NULL, "РазмерDouble" FLOAT(126) NULL, "РазмерFloat" FLOAT(53) NULL, - "РазмерDecimal" NUMBER(38) NULL, + "Сторона" NVARCHAR2(11) NULL, + + "Цвет" NVARCHAR2(255) NULL, "ТипЛапы_m0" RAW(16) NULL, @@ -872,25 +874,151 @@ CREATE TABLE "Кошка" "primaryKey" RAW(16) NOT NULL, - "Кличка" NVARCHAR2(255) NULL, + "Агрессивная" NUMBER(1) NULL, "ДатаРождения" DATE NULL, - "Тип" NVARCHAR2(11) NULL, - - "ПородаСтрокой" NVARCHAR2(255) NULL, - "Агрессивная" NUMBER(1) NULL, + "Кличка" NVARCHAR2(255) NULL, "УсыСлева" NUMBER(10) NULL, "УсыСправа" NUMBER(10) NULL, + "ПородаСтрокой" NVARCHAR2(255) NULL, + + "Тип" NVARCHAR2(11) NULL, + "Порода_m0" RAW(16) NOT NULL, PRIMARY KEY ("primaryKey") ) ; +CREATE TABLE "AgregatorWithSameMAndD" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + "Master" RAW(16) NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "DetailAndMaster" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + "Agregator" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "TestConfiguration" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "TestClass" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + "FirstLevel" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "ThirdLevel" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + "TestClass" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "SecondLevel1" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + "FirstLevel" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "FirstLevel" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + "TestConfiguration" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "SecondLevel2" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name" NVARCHAR2(255) NULL, + + "SecondLevel1_m0" RAW(16) NULL, + + "SecondLevel1_m1" RAW(16) NULL, + + "FirstLevel" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + +CREATE TABLE "TestAssociation" +( + + "primaryKey" RAW(16) NOT NULL, + + "Name2" NVARCHAR2(255) NULL, + + "Name" NVARCHAR2(255) NULL, + + "SecondLevel1_m0" RAW(16) NULL, + + "SecondLevel1_m1" RAW(16) NULL, + + "FirstLevel" RAW(16) NOT NULL, + + PRIMARY KEY ("primaryKey") +) ; + + CREATE TABLE "STORMNETLOCKDATA" ( @@ -1240,7 +1368,6 @@ CREATE INDEX "TestDetailWithCicle_ITest_3425" on "TestDetailWithCicle" ("TestMas ALTER TABLE "Детейл" ADD CONSTRAINT "Детейл_FБазов_7676" FOREIGN KEY ("БазовыйКласс_m0") REFERENCES "БазовыйКласс" ("primaryKey"); - CREATE INDEX "Детейл_IБазов_4616" on "Детейл" ("БазовыйКласс_m0"); ALTER TABLE "Детейл" @@ -1258,26 +1385,6 @@ ALTER TABLE "Журнал" CREATE INDEX "Журнал_IБибли_1176" on "Журнал" ("Библиотека2"); -ALTER TABLE "Медведь" - ADD CONSTRAINT "Медведь_FЛес_0" FOREIGN KEY ("ЛесОбитания") REFERENCES "Лес" ("primaryKey"); - -CREATE INDEX "Медведь_IЛесО_5757" on "Медведь" ("ЛесОбитания"); - -ALTER TABLE "Медведь" - ADD CONSTRAINT "Медведь_FМедв_4334" FOREIGN KEY ("Папа") REFERENCES "Медведь" ("primaryKey"); - -CREATE INDEX "Медведь_IПапа" on "Медведь" ("Папа"); - -ALTER TABLE "Медведь" - ADD CONSTRAINT "Медведь_FСтрана_0" FOREIGN KEY ("Страна") REFERENCES "Страна" ("primaryKey"); - -CREATE INDEX "Медведь_IСтрана" on "Медведь" ("Страна"); - -ALTER TABLE "Медведь" - ADD CONSTRAINT "Медведь_FМедв_4335" FOREIGN KEY ("Мама") REFERENCES "Медведь" ("primaryKey"); - -CREATE INDEX "Медведь_IМама" on "Медведь" ("Мама"); - ALTER TABLE "MainClass" ADD CONSTRAINT "MainClass_FAgrClass1_0" FOREIGN KEY ("AgrClass1") REFERENCES "AgrClass1" ("primaryKey"); @@ -1303,21 +1410,6 @@ ALTER TABLE "LegoBlock" CREATE INDEX "LegoBlock_IColor" on "LegoBlock" ("Color"); -ALTER TABLE "Берлога" - ADD CONSTRAINT "Берлога_FЛес_0" FOREIGN KEY ("ЛесРасположения") REFERENCES "Лес" ("primaryKey"); - -CREATE INDEX "Берлога_IЛесР_1411" on "Берлога" ("ЛесРасположения"); - -ALTER TABLE "Берлога" - ADD CONSTRAINT "Берлога_FПорода_0" FOREIGN KEY ("ДляКакойПороды") REFERENCES "Порода" ("primaryKey"); - -CREATE INDEX "Берлога_IДляК_2329" on "Берлога" ("ДляКакойПороды"); - -ALTER TABLE "Берлога" - ADD CONSTRAINT "Берлога_FМедв_5600" FOREIGN KEY ("Медведь") REFERENCES "Медведь" ("primaryKey"); - -CREATE INDEX "Берлога_IМедведь" on "Берлога" ("Медведь"); - ALTER TABLE "Котенок" ADD CONSTRAINT "Котенок_FКошка_0" FOREIGN KEY ("Кошка_m0") REFERENCES "Кошка" ("primaryKey"); @@ -1343,11 +1435,6 @@ ALTER TABLE "DetailsClass1" CREATE INDEX "DetailsClass1_IAgrClass1" on "DetailsClass1" ("AgrClass1"); -ALTER TABLE "Car" - ADD CONSTRAINT "Car_FDriver_0" FOREIGN KEY ("driver") REFERENCES "Driver" ("primaryKey"); - -CREATE INDEX "Car_Idriver" on "Car" ("driver"); - ALTER TABLE "LegoBlockCustomPanel" ADD CONSTRAINT "LegoBlockCustomPanel_FLeg_5205" FOREIGN KEY ("PanelAngle") REFERENCES "LegoPanelAngle" ("primaryKey"); @@ -1383,7 +1470,6 @@ ALTER TABLE "LegoBlockTopPanel" CREATE INDEX "LegoBlockTopPanel_IBlock" on "LegoBlockTopPanel" ("Block"); - ALTER TABLE "ДетейлНаследник" ADD CONSTRAINT "ДетейлНаслед_2684" FOREIGN KEY ("БазовыйКласс_m0") REFERENCES "БазовыйКласс" ("primaryKey"); @@ -1415,20 +1501,60 @@ ALTER TABLE "LegoDevice" CREATE INDEX "LegoDevice_IColor" on "LegoDevice" ("Color"); ALTER TABLE "Наследник" - ADD CONSTRAINT "Наследник_FMaster_0" FOREIGN KEY ("Master") REFERENCES "Master" ("primaryKey"); + ADD CONSTRAINT "Наследник_FМас_278" FOREIGN KEY ("Мастер") REFERENCES "Мастер" ("primaryKey"); -CREATE INDEX "Наследник_IMaster" on "Наследник" ("Master"); +CREATE INDEX "Наследник_IМа_7239" on "Наследник" ("Мастер"); ALTER TABLE "Наследник" - ADD CONSTRAINT "Наследник_FМас_278" FOREIGN KEY ("Мастер") REFERENCES "Мастер" ("primaryKey"); + ADD CONSTRAINT "Наследник_FMaster_0" FOREIGN KEY ("Master") REFERENCES "Master" ("primaryKey"); -CREATE INDEX "Наследник_IМа_7239" on "Наследник" ("Мастер"); +CREATE INDEX "Наследник_IMaster" on "Наследник" ("Master"); ALTER TABLE "LegoBlockBottomPanel" ADD CONSTRAINT "LegoBlockBottomPanel_FLeg_6473" FOREIGN KEY ("Block") REFERENCES "LegoBlock" ("primaryKey"); CREATE INDEX "LegoBlockBottomPanel_IBlock" on "LegoBlockBottomPanel" ("Block"); +ALTER TABLE "Медведь" + ADD CONSTRAINT "Медведь_FЛес_0" FOREIGN KEY ("ЛесОбитания") REFERENCES "Лес" ("primaryKey"); + +CREATE INDEX "Медведь_IЛесО_5757" on "Медведь" ("ЛесОбитания"); + +ALTER TABLE "Медведь" + ADD CONSTRAINT "Медведь_FМедв_4334" FOREIGN KEY ("Мама") REFERENCES "Медведь" ("primaryKey"); + +CREATE INDEX "Медведь_IМама" on "Медведь" ("Мама"); + +ALTER TABLE "Медведь" + ADD CONSTRAINT "Медведь_FМедв_4335" FOREIGN KEY ("Папа") REFERENCES "Медведь" ("primaryKey"); + +CREATE INDEX "Медведь_IПапа" on "Медведь" ("Папа"); + +ALTER TABLE "Медведь" + ADD CONSTRAINT "Медведь_FСтрана_0" FOREIGN KEY ("Страна") REFERENCES "Страна" ("primaryKey"); + +CREATE INDEX "Медведь_IСтрана" on "Медведь" ("Страна"); + +ALTER TABLE "Берлога" + ADD CONSTRAINT "Берлога_FЛес_0" FOREIGN KEY ("ЛесРасположения") REFERENCES "Лес" ("primaryKey"); + +CREATE INDEX "Берлога_IЛесР_1411" on "Берлога" ("ЛесРасположения"); + +ALTER TABLE "Берлога" + ADD CONSTRAINT "Берлога_FПорода_0" FOREIGN KEY ("ДляКакойПороды") REFERENCES "Порода" ("primaryKey"); + +CREATE INDEX "Берлога_IДляК_2329" on "Берлога" ("ДляКакойПороды"); + +ALTER TABLE "Берлога" + ADD CONSTRAINT "Берлога_FМедв_5600" FOREIGN KEY ("Медведь") REFERENCES "Медведь" ("primaryKey"); + +CREATE INDEX "Берлога_IМедведь" on "Берлога" ("Медведь"); + +ALTER TABLE "Car" + ADD CONSTRAINT "Car_FDriver_0" FOREIGN KEY ("driver") REFERENCES "Driver" ("primaryKey"); + +CREATE INDEX "Car_Idriver" on "Car" ("driver"); + ALTER TABLE "Перелом" ADD CONSTRAINT "Перелом_FЛапа_0" FOREIGN KEY ("Лапа_m0") REFERENCES "Лапа" ("primaryKey"); @@ -1449,6 +1575,66 @@ ALTER TABLE "Кошка" CREATE INDEX "Кошка_IПорода_m0" on "Кошка" ("Порода_m0"); +ALTER TABLE "AgregatorWithSameMAndD" + ADD CONSTRAINT "AgregatorWithSameMAndD_FDe_217" FOREIGN KEY ("Master") REFERENCES "DetailAndMaster" ("primaryKey"); + +CREATE INDEX "AgregatorWithSameMAndD_IMaster" on "AgregatorWithSameMAndD" ("Master"); + +ALTER TABLE "DetailAndMaster" + ADD CONSTRAINT "DetailAndMaster_FAgregator_188" FOREIGN KEY ("Agregator") REFERENCES "AgregatorWithSameMAndD" ("primaryKey"); + +CREATE INDEX "DetailAndMaster_IAgregator" on "DetailAndMaster" ("Agregator"); + +ALTER TABLE "TestClass" + ADD CONSTRAINT "TestClass_FFirstLevel_0" FOREIGN KEY ("FirstLevel") REFERENCES "FirstLevel" ("primaryKey"); + +CREATE INDEX "TestClass_IFirstLevel" on "TestClass" ("FirstLevel"); + +ALTER TABLE "ThirdLevel" + ADD CONSTRAINT "ThirdLevel_FTestClass_0" FOREIGN KEY ("TestClass") REFERENCES "TestClass" ("primaryKey"); + +CREATE INDEX "ThirdLevel_ITestClass" on "ThirdLevel" ("TestClass"); + +ALTER TABLE "SecondLevel1" + ADD CONSTRAINT "SecondLevel1_FFirstLevel_0" FOREIGN KEY ("FirstLevel") REFERENCES "FirstLevel" ("primaryKey"); + +CREATE INDEX "SecondLevel1_IFirstLevel" on "SecondLevel1" ("FirstLevel"); + +ALTER TABLE "FirstLevel" + ADD CONSTRAINT "FirstLevel_FTestConfigura_1288" FOREIGN KEY ("TestConfiguration") REFERENCES "TestConfiguration" ("primaryKey"); + +CREATE INDEX "FirstLevel_ITestConfiguration" on "FirstLevel" ("TestConfiguration"); + +ALTER TABLE "SecondLevel2" + ADD CONSTRAINT "SecondLevel2_FSecondLevel1_0" FOREIGN KEY ("SecondLevel1_m0") REFERENCES "SecondLevel1" ("primaryKey"); + +CREATE INDEX "SecondLevel2_ISecondLevel1_m0" on "SecondLevel2" ("SecondLevel1_m0"); + +ALTER TABLE "SecondLevel2" + ADD CONSTRAINT "SecondLevel2_FTestClass_0" FOREIGN KEY ("SecondLevel1_m1") REFERENCES "TestClass" ("primaryKey"); + +CREATE INDEX "SecondLevel2_ISecondLevel1_m1" on "SecondLevel2" ("SecondLevel1_m1"); + +ALTER TABLE "SecondLevel2" + ADD CONSTRAINT "SecondLevel2_FFirstLevel_0" FOREIGN KEY ("FirstLevel") REFERENCES "FirstLevel" ("primaryKey"); + +CREATE INDEX "SecondLevel2_IFirstLevel" on "SecondLevel2" ("FirstLevel"); + +ALTER TABLE "TestAssociation" + ADD CONSTRAINT "TestAssociation_FSecondLe_2905" FOREIGN KEY ("SecondLevel1_m0") REFERENCES "SecondLevel1" ("primaryKey"); + +CREATE INDEX "TestAssociation_ISecondLe_6355" on "TestAssociation" ("SecondLevel1_m0"); + +ALTER TABLE "TestAssociation" + ADD CONSTRAINT "TestAssociation_FTestClass_0" FOREIGN KEY ("SecondLevel1_m1") REFERENCES "TestClass" ("primaryKey"); + +CREATE INDEX "TestAssociation_ISecondLe_6356" on "TestAssociation" ("SecondLevel1_m1"); + +ALTER TABLE "TestAssociation" + ADD CONSTRAINT "TestAssociation_FFirstLevel_0" FOREIGN KEY ("FirstLevel") REFERENCES "FirstLevel" ("primaryKey"); + +CREATE INDEX "TestAssociation_IFirstLevel" on "TestAssociation" ("FirstLevel"); + ALTER TABLE "STORMWEBSEARCH" ADD CONSTRAINT "STORMWEBSEARCH_FSTORMFILT_6521" FOREIGN KEY ("FilterSetting_m0") REFERENCES "STORMFILTERSETTING" ("primaryKey"); diff --git a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/PostgreSql.create.sql b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/PostgreSql.create.sql index c1c08a94..dba4887b 100644 --- a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/PostgreSql.create.sql +++ b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/SqlScripts/PostgreSql.create.sql @@ -3,43 +3,33 @@ -CREATE TABLE Лес ( - primaryKey UUID NOT NULL, - Название VARCHAR(255) NULL, - Площадь INT NULL, - Заповедник BOOLEAN NULL, - ДатаПослОсмотра TIMESTAMP(3) NULL, - Страна UUID NULL, - PRIMARY KEY (primaryKey)); - - CREATE TABLE КлассСМножТипов ( primaryKey UUID NOT NULL, - PropertyGeography GEOMETRY NULL, - PropertyEnum VARCHAR(6) NULL, PropertyBool BOOLEAN NULL, - PropertyInt INT NULL, PropertyDateTime TIMESTAMP(3) NULL, - PropertyString VARCHAR(255) NULL, - PropertyFloat REAL NULL, - PropertyDouble DOUBLE PRECISION NULL, PropertyDecimal DECIMAL NULL, - PropertySystemNullableDateTime TIMESTAMP(3) NULL, - PropertySystemNullableInt INT NULL, - PropertySystemNullableGuid UUID NULL, - PropertySystemNullableDecimal DECIMAL NULL, - PropStormnetNullableDateTime TIMESTAMP(3) NULL, - PropertyStormnetNullableInt INT NULL, - PropertyStormnetKeyGuid UUID NULL, - PropStormnetNullableDecimal DECIMAL NULL, - PropertyStormnetPartliedDate VARCHAR(255) NULL, - PropertyStormnetContact TEXT NULL, + PropertyDouble DOUBLE PRECISION NULL, + PropertyEnum VARCHAR(6) NULL, + PropertyFloat REAL NULL, + PropertyGeography GEOMETRY NULL, + PropertyInt INT NULL, PropertyStormnetBlob TEXT NULL, + PropertyStormnetContact TEXT NULL, PropertyStormnetEvent TEXT NULL, + PropertyStormnetFile TEXT NULL, PropertyStormnetGeoData TEXT NULL, PropertyStormnetImage TEXT NULL, + PropertyStormnetKeyGuid UUID NULL, + PropStormnetNullableDateTime TIMESTAMP(3) NULL, + PropStormnetNullableDecimal DECIMAL NULL, + PropertyStormnetNullableInt INT NULL, + PropertyStormnetPartliedDate VARCHAR(255) NULL, PropertyStormnetWebFile TEXT NULL, - PropertyStormnetFile TEXT NULL, + PropertyString VARCHAR(255) NULL, + PropertySystemNullableDateTime TIMESTAMP(3) NULL, + PropertySystemNullableDecimal DECIMAL NULL, + PropertySystemNullableGuid UUID NULL, + PropertySystemNullableInt INT NULL, PRIMARY KEY (primaryKey)); @@ -49,12 +39,22 @@ CREATE TABLE Master ( PRIMARY KEY (primaryKey)); +CREATE TABLE Лес ( + primaryKey UUID NOT NULL, + ДатаПослОсмотра TIMESTAMP(3) NULL, + Заповедник BOOLEAN NULL, + Название VARCHAR(255) NULL, + Площадь INT NULL, + Страна UUID NULL, + PRIMARY KEY (primaryKey)); + + CREATE TABLE LegoPatent ( primaryKey UUID NOT NULL, - Name VARCHAR(255) NULL, - Date TIMESTAMP(3) NULL, Authors VARCHAR(255) NULL, + Date TIMESTAMP(3) NULL, Description VARCHAR(255) NULL, + Name VARCHAR(255) NULL, LegoBlock UUID NULL, LegoDevice UUID NULL, PRIMARY KEY (primaryKey)); @@ -117,9 +117,9 @@ CREATE TABLE Детейл ( CREATE TABLE Driver ( primaryKey UUID NOT NULL, - Name VARCHAR(255) NULL, CarCount INT NULL, Documents BOOLEAN NULL, + Name VARCHAR(255) NULL, PRIMARY KEY (primaryKey)); @@ -138,25 +138,6 @@ CREATE TABLE Журнал ( PRIMARY KEY (primaryKey)); -CREATE TABLE Медведь ( - primaryKey UUID NOT NULL, - ПолеБС VARCHAR(255) NULL, - ПорядковыйНомер INT NULL, - Вес INT NULL, - ЦветГлаз VARCHAR(255) NULL, - Пол VARCHAR(9) NULL, - ДатаРождения TIMESTAMP(3) NULL, - CreateTime TIMESTAMP(3) NULL, - Creator VARCHAR(255) NULL, - EditTime TIMESTAMP(3) NULL, - Editor VARCHAR(255) NULL, - ЛесОбитания UUID NULL, - Папа UUID NULL, - Страна UUID NULL, - Мама UUID NULL, - PRIMARY KEY (primaryKey)); - - CREATE TABLE TestMaster ( primaryKey UUID NOT NULL, TestMasterName VARCHAR(255) NULL, @@ -180,35 +161,21 @@ CREATE TABLE Порода ( CREATE TABLE LegoBlock ( primaryKey UUID NOT NULL, - Width INT NULL, - Height INT NULL, - Depth INT NULL, Configuration VARCHAR(255) NULL, - Name VARCHAR(255) NULL, + Depth INT NULL, + Height INT NULL, + Width INT NULL, BlockId INT NULL, + Name VARCHAR(255) NULL, Material UUID NULL, Color UUID NULL, PRIMARY KEY (primaryKey)); -CREATE TABLE Берлога ( - primaryKey UUID NOT NULL, - ПолеБС VARCHAR(255) NULL, - Наименование VARCHAR(255) NULL, - Комфортность INT NULL, - Заброшена BOOLEAN NULL, - Сертификат TEXT NULL, - CertString TEXT NULL, - ЛесРасположения UUID NULL, - ДляКакойПороды UUID NULL, - Медведь UUID NOT NULL, - PRIMARY KEY (primaryKey)); - - CREATE TABLE LegoBlockColor ( primaryKey UUID NOT NULL, - Name VARCHAR(255) NULL, ColorNumber INT NULL, + Name VARCHAR(255) NULL, PRIMARY KEY (primaryKey)); @@ -220,8 +187,8 @@ CREATE TABLE ПоставщикКниг ( CREATE TABLE Котенок ( primaryKey UUID NOT NULL, - КличкаКотенка VARCHAR(255) NULL, Глупость INT NULL, + КличкаКотенка VARCHAR(255) NULL, Кошка_m0 UUID NOT NULL, PRIMARY KEY (primaryKey)); @@ -249,15 +216,6 @@ CREATE TABLE DetailsClass1 ( PRIMARY KEY (primaryKey)); -CREATE TABLE Car ( - primaryKey UUID NOT NULL, - Number VARCHAR(255) NULL, - Model VARCHAR(255) NULL, - TipCar VARCHAR(9) NULL, - driver UUID NOT NULL, - PRIMARY KEY (primaryKey)); - - CREATE TABLE LegoBlockCustomPanel ( primaryKey UUID NOT NULL, Orientation VARCHAR(255) NULL, @@ -269,8 +227,8 @@ CREATE TABLE LegoBlockCustomPanel ( CREATE TABLE ТипЛапы ( primaryKey UUID NOT NULL, - Название VARCHAR(255) NULL, Актуально BOOLEAN NULL, + Название VARCHAR(255) NULL, PRIMARY KEY (primaryKey)); @@ -282,8 +240,8 @@ CREATE TABLE AgrClass1 ( CREATE TABLE LegoPanelAngle ( primaryKey UUID NOT NULL, - Name VARCHAR(255) NULL, Angle INT NULL, + Name VARCHAR(255) NULL, PRIMARY KEY (primaryKey)); @@ -335,15 +293,15 @@ CREATE TABLE AgrClass2 ( CREATE TABLE ТипПороды ( primaryKey UUID NOT NULL, - Название VARCHAR(255) NULL, ДатаРегистрации TIMESTAMP(3) NULL, + Название VARCHAR(255) NULL, PRIMARY KEY (primaryKey)); CREATE TABLE LegoBlockTopPanel ( primaryKey UUID NOT NULL, - WidthCount INT NULL, HeightCount INT NULL, + WidthCount INT NULL, SocketStandard UUID NULL, Block UUID NOT NULL, PRIMARY KEY (primaryKey)); @@ -383,8 +341,8 @@ CREATE TABLE LegoDevice ( primaryKey UUID NOT NULL, Description VARCHAR(255) NULL, Electricity BOOLEAN NULL, - Name VARCHAR(255) NULL, BlockId INT NULL, + Name VARCHAR(255) NULL, Color UUID NULL, PRIMARY KEY (primaryKey)); @@ -394,15 +352,15 @@ CREATE TABLE Наследник ( Свойство DOUBLE PRECISION NULL, Свойство1 VARCHAR(255) NULL, Свойство2 INT NULL, - Master UUID NULL, Мастер UUID NULL, + Master UUID NULL, PRIMARY KEY (primaryKey)); CREATE TABLE LegoBlockBottomPanel ( primaryKey UUID NOT NULL, - WidthCount INT NULL, HeightCount INT NULL, + WidthCount INT NULL, Block UUID NOT NULL, PRIMARY KEY (primaryKey)); @@ -410,31 +368,73 @@ CREATE TABLE LegoBlockBottomPanel ( CREATE TABLE ДочернийКласс ( primaryKey UUID NOT NULL, ChildProperty VARCHAR(255) NULL, - PropertyGeography GEOMETRY NULL, - PropertyEnum VARCHAR(6) NULL, PropertyBool BOOLEAN NULL, - PropertyInt INT NULL, PropertyDateTime TIMESTAMP(3) NULL, - PropertyString VARCHAR(255) NULL, - PropertyFloat REAL NULL, - PropertyDouble DOUBLE PRECISION NULL, PropertyDecimal DECIMAL NULL, - PropertySystemNullableDateTime TIMESTAMP(3) NULL, - PropertySystemNullableInt INT NULL, - PropertySystemNullableGuid UUID NULL, - PropertySystemNullableDecimal DECIMAL NULL, - PropStormnetNullableDateTime TIMESTAMP(3) NULL, - PropertyStormnetNullableInt INT NULL, - PropertyStormnetKeyGuid UUID NULL, - PropStormnetNullableDecimal DECIMAL NULL, - PropertyStormnetPartliedDate VARCHAR(255) NULL, - PropertyStormnetContact TEXT NULL, + PropertyDouble DOUBLE PRECISION NULL, + PropertyEnum VARCHAR(6) NULL, + PropertyFloat REAL NULL, + PropertyGeography GEOMETRY NULL, + PropertyInt INT NULL, PropertyStormnetBlob TEXT NULL, + PropertyStormnetContact TEXT NULL, PropertyStormnetEvent TEXT NULL, + PropertyStormnetFile TEXT NULL, PropertyStormnetGeoData TEXT NULL, PropertyStormnetImage TEXT NULL, + PropertyStormnetKeyGuid UUID NULL, + PropStormnetNullableDateTime TIMESTAMP(3) NULL, + PropStormnetNullableDecimal DECIMAL NULL, + PropertyStormnetNullableInt INT NULL, + PropertyStormnetPartliedDate VARCHAR(255) NULL, PropertyStormnetWebFile TEXT NULL, - PropertyStormnetFile TEXT NULL, + PropertyString VARCHAR(255) NULL, + PropertySystemNullableDateTime TIMESTAMP(3) NULL, + PropertySystemNullableDecimal DECIMAL NULL, + PropertySystemNullableGuid UUID NULL, + PropertySystemNullableInt INT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE Медведь ( + primaryKey UUID NOT NULL, + Вес INT NULL, + ДатаРождения TIMESTAMP(3) NULL, + Пол VARCHAR(9) NULL, + ПолеБС VARCHAR(255) NULL, + ПорядковыйНомер INT NULL, + ЦветГлаз VARCHAR(255) NULL, + CreateTime TIMESTAMP(3) NULL, + Creator VARCHAR(255) NULL, + Editor VARCHAR(255) NULL, + EditTime TIMESTAMP(3) NULL, + ЛесОбитания UUID NULL, + Мама UUID NULL, + Папа UUID NULL, + Страна UUID NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE Берлога ( + primaryKey UUID NOT NULL, + Заброшена BOOLEAN NULL, + Комфортность INT NULL, + Наименование VARCHAR(255) NULL, + ПолеБС VARCHAR(255) NULL, + Сертификат TEXT NULL, + CertString TEXT NULL, + ЛесРасположения UUID NULL, + ДляКакойПороды UUID NULL, + Медведь UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE Car ( + primaryKey UUID NOT NULL, + Model VARCHAR(255) NULL, + Number VARCHAR(255) NULL, + TipCar VARCHAR(9) NULL, + driver UUID NOT NULL, PRIMARY KEY (primaryKey)); @@ -448,15 +448,15 @@ CREATE TABLE Перелом ( CREATE TABLE Лапа ( primaryKey UUID NOT NULL, - Цвет VARCHAR(255) NULL, - Размер INT NULL, - ДатаРождения TIMESTAMP(3) NULL, БылиЛиПереломы BOOLEAN NULL, - Сторона VARCHAR(11) NULL, + ДатаРождения TIMESTAMP(3) NULL, Номер INT NULL, + Размер INT NULL, + РазмерDecimal DECIMAL NULL, РазмерDouble DOUBLE PRECISION NULL, РазмерFloat REAL NULL, - РазмерDecimal DECIMAL NULL, + Сторона VARCHAR(11) NULL, + Цвет VARCHAR(255) NULL, ТипЛапы_m0 UUID NULL, Кошка_m0 UUID NOT NULL, PRIMARY KEY (primaryKey)); @@ -464,17 +464,84 @@ CREATE TABLE Лапа ( CREATE TABLE Кошка ( primaryKey UUID NOT NULL, - Кличка VARCHAR(255) NULL, - ДатаРождения TIMESTAMP(3) NULL, - Тип VARCHAR(11) NULL, - ПородаСтрокой VARCHAR(255) NULL, Агрессивная BOOLEAN NULL, + ДатаРождения TIMESTAMP(3) NULL, + Кличка VARCHAR(255) NULL, УсыСлева INT NULL, УсыСправа INT NULL, + ПородаСтрокой VARCHAR(255) NULL, + Тип VARCHAR(11) NULL, Порода_m0 UUID NOT NULL, PRIMARY KEY (primaryKey)); +CREATE TABLE AgregatorWithSameMAndD ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + Master UUID NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE DetailAndMaster ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + Agregator UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE TestConfiguration ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE TestClass ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + FirstLevel UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE ThirdLevel ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + TestClass UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE SecondLevel1 ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + FirstLevel UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE FirstLevel ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + TestConfiguration UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE SecondLevel2 ( + primaryKey UUID NOT NULL, + Name VARCHAR(255) NULL, + SecondLevel1_m0 UUID NULL, + SecondLevel1_m1 UUID NULL, + FirstLevel UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + +CREATE TABLE TestAssociation ( + primaryKey UUID NOT NULL, + Name2 VARCHAR(255) NULL, + Name VARCHAR(255) NULL, + SecondLevel1_m0 UUID NULL, + SecondLevel1_m1 UUID NULL, + FirstLevel UUID NOT NULL, + PRIMARY KEY (primaryKey)); + + CREATE TABLE STORMNETLOCKDATA ( LockKey VARCHAR(300) NOT NULL, UserName VARCHAR(300) NOT NULL, @@ -607,10 +674,10 @@ CREATE TABLE STORMAuField ( PRIMARY KEY (primaryKey)); +CREATE INDEX Indexc5f9d71c0704ea7b966afcfdc89dc7eabe2d0c43 on КлассСМножТипов USING gist (PropertyGeography); ALTER TABLE Лес ADD CONSTRAINT FKd3bd1222072f531605e73e66656fe58296c8bfd2 FOREIGN KEY (Страна) REFERENCES Страна; CREATE INDEX Indexd3bd1222072f531605e73e66656fe58296c8bfd2 on Лес (Страна); -CREATE INDEX Indexc5f9d71c0704ea7b966afcfdc89dc7eabe2d0c43 on КлассСМножТипов USING gist (PropertyGeography); ALTER TABLE LegoPatent ADD CONSTRAINT FK849bc80cb1cf2d804429cfd10a756cb914e3fece FOREIGN KEY (LegoBlock) REFERENCES LegoBlock; CREATE INDEX Index849bc80cb1cf2d804429cfd10a756cb914e3fece on LegoPatent (LegoBlock); @@ -642,18 +709,6 @@ CREATE INDEX Index51fce8ede8f7716be28b6975505b1f9e738cc71c on Журнал (Ав ALTER TABLE Журнал ADD CONSTRAINT FK93c8f6bdc15c74cea64c3d56754d8263c4f0ceb5 FOREIGN KEY (Библиотека2) REFERENCES Библиотека; CREATE INDEX Index93c8f6bdc15c74cea64c3d56754d8263c4f0ceb5 on Журнал (Библиотека2); - ALTER TABLE Медведь ADD CONSTRAINT FK93be01a32cae64dc4b18705ade6683f41a32c367 FOREIGN KEY (ЛесОбитания) REFERENCES Лес; -CREATE INDEX Index93be01a32cae64dc4b18705ade6683f41a32c367 on Медведь (ЛесОбитания); - - ALTER TABLE Медведь ADD CONSTRAINT FK0ca403a899ac5a709a19bbb9ada47b0060e5b819 FOREIGN KEY (Папа) REFERENCES Медведь; -CREATE INDEX Index0ca403a899ac5a709a19bbb9ada47b0060e5b819 on Медведь (Папа); - - ALTER TABLE Медведь ADD CONSTRAINT FK6d8033494746b0bb87ba367c83d273dfa11b8f59 FOREIGN KEY (Страна) REFERENCES Страна; -CREATE INDEX Index6d8033494746b0bb87ba367c83d273dfa11b8f59 on Медведь (Страна); - - ALTER TABLE Медведь ADD CONSTRAINT FK0b9f6ad0caded1971696ef6602e8a2831fa941b1 FOREIGN KEY (Мама) REFERENCES Медведь; -CREATE INDEX Index0b9f6ad0caded1971696ef6602e8a2831fa941b1 on Медведь (Мама); - ALTER TABLE MainClass ADD CONSTRAINT FK685ab69befdffb9de6fa545fb70cd50905f15ac0 FOREIGN KEY (AgrClass1) REFERENCES AgrClass1; CREATE INDEX Index685ab69befdffb9de6fa545fb70cd50905f15ac0 on MainClass (AgrClass1); @@ -669,15 +724,6 @@ CREATE INDEX Index4cfb6296b76f57183c4e2ee17b66be5bed463d0f on LegoBlock (Materia ALTER TABLE LegoBlock ADD CONSTRAINT FK9f2f5e18e6674969f5e82da37bf4b5a2a1d4713a FOREIGN KEY (Color) REFERENCES LegoBlockColor; CREATE INDEX Index9f2f5e18e6674969f5e82da37bf4b5a2a1d4713a on LegoBlock (Color); - ALTER TABLE Берлога ADD CONSTRAINT FKa74603e81cb82d318a92d5d3e374895fe242d80e FOREIGN KEY (ЛесРасположения) REFERENCES Лес; -CREATE INDEX Indexa74603e81cb82d318a92d5d3e374895fe242d80e on Берлога (ЛесРасположения); - - ALTER TABLE Берлога ADD CONSTRAINT FKd55a7fa30b428d1be64b1b8e2ac5b525597ef56b FOREIGN KEY (ДляКакойПороды) REFERENCES Порода; -CREATE INDEX Indexd55a7fa30b428d1be64b1b8e2ac5b525597ef56b on Берлога (ДляКакойПороды); - - ALTER TABLE Берлога ADD CONSTRAINT FK838e30a686c4f1dcfbb02e55d47218e48ddbe7a2 FOREIGN KEY (Медведь) REFERENCES Медведь; -CREATE INDEX Index838e30a686c4f1dcfbb02e55d47218e48ddbe7a2 on Берлога (Медведь); - ALTER TABLE Котенок ADD CONSTRAINT FK79a0f583830fea7f95d716cc96a27d0967a2d537 FOREIGN KEY (Кошка_m0) REFERENCES Кошка; CREATE INDEX Index79a0f583830fea7f95d716cc96a27d0967a2d537 on Котенок (Кошка_m0); @@ -693,9 +739,6 @@ CREATE INDEX Indexfb36ebac9beeb237cccb40b7be9cf2d25e9247b9 on DetailsClass1 (Det ALTER TABLE DetailsClass1 ADD CONSTRAINT FK10455ebe27fd31555ad2502ede3706a815784321 FOREIGN KEY (AgrClass1) REFERENCES AgrClass1; CREATE INDEX Index10455ebe27fd31555ad2502ede3706a815784321 on DetailsClass1 (AgrClass1); - ALTER TABLE Car ADD CONSTRAINT FKe86a1d047f4df342bf39a5af864aec2b40a3547a FOREIGN KEY (driver) REFERENCES Driver; -CREATE INDEX Indexe86a1d047f4df342bf39a5af864aec2b40a3547a on Car (driver); - ALTER TABLE LegoBlockCustomPanel ADD CONSTRAINT FK53e2141b982788b2970c50d23073a5847e47d81c FOREIGN KEY (PanelAngle) REFERENCES LegoPanelAngle; CREATE INDEX Index53e2141b982788b2970c50d23073a5847e47d81c on LegoBlockCustomPanel (PanelAngle); @@ -735,16 +778,40 @@ CREATE INDEX Index84e4d9d5b6adc4bec48541216f15f396dd2b602c on Книга (Биб ALTER TABLE LegoDevice ADD CONSTRAINT FKafee67e1a41c2550c0f3df3724edf1b0be74db9f FOREIGN KEY (Color) REFERENCES LegoBlockColor; CREATE INDEX Indexafee67e1a41c2550c0f3df3724edf1b0be74db9f on LegoDevice (Color); - ALTER TABLE Наследник ADD CONSTRAINT FK0cb9ac2b0e7896223ed63c0c888c23aa86682b1e FOREIGN KEY (Master) REFERENCES Master; -CREATE INDEX Index0cb9ac2b0e7896223ed63c0c888c23aa86682b1e on Наследник (Master); - ALTER TABLE Наследник ADD CONSTRAINT FK28ac1d61524a43a59e67af57a855ad487d1f8141 FOREIGN KEY (Мастер) REFERENCES Мастер; CREATE INDEX Index28ac1d61524a43a59e67af57a855ad487d1f8141 on Наследник (Мастер); + ALTER TABLE Наследник ADD CONSTRAINT FK0cb9ac2b0e7896223ed63c0c888c23aa86682b1e FOREIGN KEY (Master) REFERENCES Master; +CREATE INDEX Index0cb9ac2b0e7896223ed63c0c888c23aa86682b1e on Наследник (Master); + ALTER TABLE LegoBlockBottomPanel ADD CONSTRAINT FKba0e912f138a900a9d416b459d0b38e70871f043 FOREIGN KEY (Block) REFERENCES LegoBlock; CREATE INDEX Indexba0e912f138a900a9d416b459d0b38e70871f043 on LegoBlockBottomPanel (Block); CREATE INDEX Index10d981ac5288ea278311b6a711b43fa954b635a8 on ДочернийКласс USING gist (PropertyGeography); + ALTER TABLE Медведь ADD CONSTRAINT FK93be01a32cae64dc4b18705ade6683f41a32c367 FOREIGN KEY (ЛесОбитания) REFERENCES Лес; +CREATE INDEX Index93be01a32cae64dc4b18705ade6683f41a32c367 on Медведь (ЛесОбитания); + + ALTER TABLE Медведь ADD CONSTRAINT FK0b9f6ad0caded1971696ef6602e8a2831fa941b1 FOREIGN KEY (Мама) REFERENCES Медведь; +CREATE INDEX Index0b9f6ad0caded1971696ef6602e8a2831fa941b1 on Медведь (Мама); + + ALTER TABLE Медведь ADD CONSTRAINT FK0ca403a899ac5a709a19bbb9ada47b0060e5b819 FOREIGN KEY (Папа) REFERENCES Медведь; +CREATE INDEX Index0ca403a899ac5a709a19bbb9ada47b0060e5b819 on Медведь (Папа); + + ALTER TABLE Медведь ADD CONSTRAINT FK6d8033494746b0bb87ba367c83d273dfa11b8f59 FOREIGN KEY (Страна) REFERENCES Страна; +CREATE INDEX Index6d8033494746b0bb87ba367c83d273dfa11b8f59 on Медведь (Страна); + + ALTER TABLE Берлога ADD CONSTRAINT FKa74603e81cb82d318a92d5d3e374895fe242d80e FOREIGN KEY (ЛесРасположения) REFERENCES Лес; +CREATE INDEX Indexa74603e81cb82d318a92d5d3e374895fe242d80e on Берлога (ЛесРасположения); + + ALTER TABLE Берлога ADD CONSTRAINT FKd55a7fa30b428d1be64b1b8e2ac5b525597ef56b FOREIGN KEY (ДляКакойПороды) REFERENCES Порода; +CREATE INDEX Indexd55a7fa30b428d1be64b1b8e2ac5b525597ef56b on Берлога (ДляКакойПороды); + + ALTER TABLE Берлога ADD CONSTRAINT FK838e30a686c4f1dcfbb02e55d47218e48ddbe7a2 FOREIGN KEY (Медведь) REFERENCES Медведь; +CREATE INDEX Index838e30a686c4f1dcfbb02e55d47218e48ddbe7a2 on Берлога (Медведь); + + ALTER TABLE Car ADD CONSTRAINT FKe86a1d047f4df342bf39a5af864aec2b40a3547a FOREIGN KEY (driver) REFERENCES Driver; +CREATE INDEX Indexe86a1d047f4df342bf39a5af864aec2b40a3547a on Car (driver); + ALTER TABLE Перелом ADD CONSTRAINT FK6dee404d2bb9702d8d72537c5ae42a7c97dfb5fa FOREIGN KEY (Лапа_m0) REFERENCES Лапа; CREATE INDEX Index6dee404d2bb9702d8d72537c5ae42a7c97dfb5fa on Перелом (Лапа_m0); @@ -757,6 +824,42 @@ CREATE INDEX Indexd2c2995f4deb3767b25fa4ca17d61bf9bff3d562 on Лапа (Кошк ALTER TABLE Кошка ADD CONSTRAINT FK271599c8f6730bbff77fe5e9bf61dbfd89e661c6 FOREIGN KEY (Порода_m0) REFERENCES Порода; CREATE INDEX Index271599c8f6730bbff77fe5e9bf61dbfd89e661c6 on Кошка (Порода_m0); + ALTER TABLE AgregatorWithSameMAndD ADD CONSTRAINT FK8b53b11c59bd038385b48bae2e4c94deed6a1407 FOREIGN KEY (Master) REFERENCES DetailAndMaster; +CREATE INDEX Index8b53b11c59bd038385b48bae2e4c94deed6a1407 on AgregatorWithSameMAndD (Master); + + ALTER TABLE DetailAndMaster ADD CONSTRAINT FK0c88fee611c8abca27c4c3da5367b44eee5fc8e5 FOREIGN KEY (Agregator) REFERENCES AgregatorWithSameMAndD; +CREATE INDEX Index0c88fee611c8abca27c4c3da5367b44eee5fc8e5 on DetailAndMaster (Agregator); + + ALTER TABLE TestClass ADD CONSTRAINT FK19773cb98a250f476592752b07236351a92e0459 FOREIGN KEY (FirstLevel) REFERENCES FirstLevel; +CREATE INDEX Index19773cb98a250f476592752b07236351a92e0459 on TestClass (FirstLevel); + + ALTER TABLE ThirdLevel ADD CONSTRAINT FK984d4e99324a5c45442934f0ab98b220f32de93a FOREIGN KEY (TestClass) REFERENCES TestClass; +CREATE INDEX Index984d4e99324a5c45442934f0ab98b220f32de93a on ThirdLevel (TestClass); + + ALTER TABLE SecondLevel1 ADD CONSTRAINT FKfd7eab05fadb3cdc2d524a4e44a7e9180d6fb17a FOREIGN KEY (FirstLevel) REFERENCES FirstLevel; +CREATE INDEX Indexfd7eab05fadb3cdc2d524a4e44a7e9180d6fb17a on SecondLevel1 (FirstLevel); + + ALTER TABLE FirstLevel ADD CONSTRAINT FK7b6f1cb3f01146be11a3378612a4fb0be742e10d FOREIGN KEY (TestConfiguration) REFERENCES TestConfiguration; +CREATE INDEX Index7b6f1cb3f01146be11a3378612a4fb0be742e10d on FirstLevel (TestConfiguration); + + ALTER TABLE SecondLevel2 ADD CONSTRAINT FK22e45e92a053d7e929e24654ac8c10aba4fa49b0 FOREIGN KEY (SecondLevel1_m0) REFERENCES SecondLevel1; +CREATE INDEX Index22e45e92a053d7e929e24654ac8c10aba4fa49b0 on SecondLevel2 (SecondLevel1_m0); + + ALTER TABLE SecondLevel2 ADD CONSTRAINT FK34d92026b39c8d9b4ae1c6b730803be60ba832af FOREIGN KEY (SecondLevel1_m1) REFERENCES TestClass; +CREATE INDEX Index34d92026b39c8d9b4ae1c6b730803be60ba832af on SecondLevel2 (SecondLevel1_m1); + + ALTER TABLE SecondLevel2 ADD CONSTRAINT FKe2843f3145fc62736d407262ab698b69e37abc7a FOREIGN KEY (FirstLevel) REFERENCES FirstLevel; +CREATE INDEX Indexe2843f3145fc62736d407262ab698b69e37abc7a on SecondLevel2 (FirstLevel); + + ALTER TABLE TestAssociation ADD CONSTRAINT FK75ff68881ab55589c4860bf07c4d70899aeba780 FOREIGN KEY (SecondLevel1_m0) REFERENCES SecondLevel1; +CREATE INDEX Index75ff68881ab55589c4860bf07c4d70899aeba780 on TestAssociation (SecondLevel1_m0); + + ALTER TABLE TestAssociation ADD CONSTRAINT FK33293a87ee605ad37917bdfcc64e848d124c4458 FOREIGN KEY (SecondLevel1_m1) REFERENCES TestClass; +CREATE INDEX Index33293a87ee605ad37917bdfcc64e848d124c4458 on TestAssociation (SecondLevel1_m1); + + ALTER TABLE TestAssociation ADD CONSTRAINT FK2c1bef67ce5243233fabd0b55b2f07496ce332d0 FOREIGN KEY (FirstLevel) REFERENCES FirstLevel; +CREATE INDEX Index2c1bef67ce5243233fabd0b55b2f07496ce332d0 on TestAssociation (FirstLevel); + ALTER TABLE STORMWEBSEARCH ADD CONSTRAINT FKc4378e39870eb056aec84088683297a01d2a6200 FOREIGN KEY (FilterSetting_m0) REFERENCES STORMFILTERSETTING; ALTER TABLE STORMFILTERDETAIL ADD CONSTRAINT FK921d16269835017e2a0d0e29ad6fb175454a70d0 FOREIGN KEY (FilterSetting_m0) REFERENCES STORMFILTERSETTING; diff --git a/Tests/Objects/AgregatorWithSameMAndD.cs b/Tests/Objects/AgregatorWithSameMAndD.cs new file mode 100644 index 00000000..c4ef0479 --- /dev/null +++ b/Tests/Objects/AgregatorWithSameMAndD.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// AgregatorWithSameMAndD. + /// + // *** Start programmer edit section *** (AgregatorWithSameMAndD CustomAttributes) + + // *** End programmer edit section *** (AgregatorWithSameMAndD CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class AgregatorWithSameMAndD : ICSSoft.STORMNET.DataObject + { + + private string fName; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.DetailAndMaster fMaster; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfDetailAndMaster fDetails; + + // *** Start programmer edit section *** (AgregatorWithSameMAndD CustomMembers) + + // *** End programmer edit section *** (AgregatorWithSameMAndD CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Name CustomAttributes) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Name CustomAttributes) + [StrLen(255)] + public virtual string Name + { + get + { + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Name Get start) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Name Get start) + string result = this.fName; + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Name Get end) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Name Set start) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Name Set start) + this.fName = value; + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Name Set end) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Name Set end) + } + } + + /// + /// AgregatorWithSameMAndD. + /// + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Master CustomAttributes) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Master CustomAttributes) + [PropertyStorage(new string[] { + "Master"})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.DetailAndMaster Master + { + get + { + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Master Get start) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Master Get start) + NewPlatform.Flexberry.ORM.ODataService.Tests.DetailAndMaster result = this.fMaster; + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Master Get end) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Master Get end) + return result; + } + set + { + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Master Set start) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Master Set start) + this.fMaster = value; + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Master Set end) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Master Set end) + } + } + + /// + /// AgregatorWithSameMAndD. + /// + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Details CustomAttributes) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Details CustomAttributes) + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfDetailAndMaster Details + { + get + { + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Details Get start) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Details Get start) + if ((this.fDetails == null)) + { + this.fDetails = new NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfDetailAndMaster(this); + } + NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfDetailAndMaster result = this.fDetails; + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Details Get end) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Details Get end) + return result; + } + set + { + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Details Set start) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Details Set start) + this.fDetails = value; + // *** Start programmer edit section *** (AgregatorWithSameMAndD.Details Set end) + + // *** End programmer edit section *** (AgregatorWithSameMAndD.Details Set end) + } + } + } +} + diff --git a/Tests/Objects/DetailAndMaster.cs b/Tests/Objects/DetailAndMaster.cs new file mode 100644 index 00000000..281f8ac7 --- /dev/null +++ b/Tests/Objects/DetailAndMaster.cs @@ -0,0 +1,150 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// DetailAndMaster. + /// + // *** Start programmer edit section *** (DetailAndMaster CustomAttributes) + + // *** End programmer edit section *** (DetailAndMaster CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class DetailAndMaster : ICSSoft.STORMNET.DataObject + { + + private string fName; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.AgregatorWithSameMAndD fAgregator; + + // *** Start programmer edit section *** (DetailAndMaster CustomMembers) + + // *** End programmer edit section *** (DetailAndMaster CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (DetailAndMaster.Name CustomAttributes) + + // *** End programmer edit section *** (DetailAndMaster.Name CustomAttributes) + [StrLen(255)] + public virtual string Name + { + get + { + // *** Start programmer edit section *** (DetailAndMaster.Name Get start) + + // *** End programmer edit section *** (DetailAndMaster.Name Get start) + string result = this.fName; + // *** Start programmer edit section *** (DetailAndMaster.Name Get end) + + // *** End programmer edit section *** (DetailAndMaster.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (DetailAndMaster.Name Set start) + + // *** End programmer edit section *** (DetailAndMaster.Name Set start) + this.fName = value; + // *** Start programmer edit section *** (DetailAndMaster.Name Set end) + + // *** End programmer edit section *** (DetailAndMaster.Name Set end) + } + } + + /// + /// мастеровая ссылка на шапку NewPlatform.Flexberry.ORM.ODataService.Tests.AgregatorWithSameMAndD. + /// + // *** Start programmer edit section *** (DetailAndMaster.Agregator CustomAttributes) + + // *** End programmer edit section *** (DetailAndMaster.Agregator CustomAttributes) + [Agregator()] + [NotNull()] + [PropertyStorage(new string[] { + "Agregator"})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.AgregatorWithSameMAndD Agregator + { + get + { + // *** Start programmer edit section *** (DetailAndMaster.Agregator Get start) + + // *** End programmer edit section *** (DetailAndMaster.Agregator Get start) + NewPlatform.Flexberry.ORM.ODataService.Tests.AgregatorWithSameMAndD result = this.fAgregator; + // *** Start programmer edit section *** (DetailAndMaster.Agregator Get end) + + // *** End programmer edit section *** (DetailAndMaster.Agregator Get end) + return result; + } + set + { + // *** Start programmer edit section *** (DetailAndMaster.Agregator Set start) + + // *** End programmer edit section *** (DetailAndMaster.Agregator Set start) + this.fAgregator = value; + // *** Start programmer edit section *** (DetailAndMaster.Agregator Set end) + + // *** End programmer edit section *** (DetailAndMaster.Agregator Set end) + } + } + } + + /// + /// Detail array of DetailAndMaster. + /// + // *** Start programmer edit section *** (DetailArrayDetailArrayOfDetailAndMaster CustomAttributes) + + // *** End programmer edit section *** (DetailArrayDetailArrayOfDetailAndMaster CustomAttributes) + public class DetailArrayOfDetailAndMaster : ICSSoft.STORMNET.DetailArray + { + + // *** Start programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfDetailAndMaster members) + + // *** End programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfDetailAndMaster members) + + + /// + /// Construct detail array. + /// + /// + /// Returns object with type DetailAndMaster by index. + /// + /// + /// Adds object with type DetailAndMaster. + /// + public DetailArrayOfDetailAndMaster(NewPlatform.Flexberry.ORM.ODataService.Tests.AgregatorWithSameMAndD fAgregatorWithSameMAndD) : + base(typeof(DetailAndMaster), ((ICSSoft.STORMNET.DataObject)(fAgregatorWithSameMAndD))) + { + } + + public NewPlatform.Flexberry.ORM.ODataService.Tests.DetailAndMaster this[int index] + { + get + { + return ((NewPlatform.Flexberry.ORM.ODataService.Tests.DetailAndMaster)(this.ItemByIndex(index))); + } + } + + public virtual void Add(NewPlatform.Flexberry.ORM.ODataService.Tests.DetailAndMaster dataobject) + { + this.AddObject(((ICSSoft.STORMNET.DataObject)(dataobject))); + } + } +} + diff --git a/Tests/Objects/FirstLevel.cs b/Tests/Objects/FirstLevel.cs new file mode 100644 index 00000000..3d82efd9 --- /dev/null +++ b/Tests/Objects/FirstLevel.cs @@ -0,0 +1,230 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// FirstLevel. + /// + // *** Start programmer edit section *** (FirstLevel CustomAttributes) + + // *** End programmer edit section *** (FirstLevel CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class FirstLevel : ICSSoft.STORMNET.DataObject + { + + private string fName; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel1 fSecondLevel1; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel2 fSecondLevel2; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.TestConfiguration fTestConfiguration; + + // *** Start programmer edit section *** (FirstLevel CustomMembers) + + // *** End programmer edit section *** (FirstLevel CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (FirstLevel.Name CustomAttributes) + + // *** End programmer edit section *** (FirstLevel.Name CustomAttributes) + [StrLen(255)] + public virtual string Name + { + get + { + // *** Start programmer edit section *** (FirstLevel.Name Get start) + + // *** End programmer edit section *** (FirstLevel.Name Get start) + string result = this.fName; + // *** Start programmer edit section *** (FirstLevel.Name Get end) + + // *** End programmer edit section *** (FirstLevel.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (FirstLevel.Name Set start) + + // *** End programmer edit section *** (FirstLevel.Name Set start) + this.fName = value; + // *** Start programmer edit section *** (FirstLevel.Name Set end) + + // *** End programmer edit section *** (FirstLevel.Name Set end) + } + } + + /// + /// FirstLevel. + /// + // *** Start programmer edit section *** (FirstLevel.SecondLevel1 CustomAttributes) + + // *** End programmer edit section *** (FirstLevel.SecondLevel1 CustomAttributes) + [TypeUsage(new System.Type[] { + typeof(NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1), + typeof(NewPlatform.Flexberry.ORM.ODataService.Tests.TestClass)})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel1 SecondLevel1 + { + get + { + // *** Start programmer edit section *** (FirstLevel.SecondLevel1 Get start) + + // *** End programmer edit section *** (FirstLevel.SecondLevel1 Get start) + if ((this.fSecondLevel1 == null)) + { + this.fSecondLevel1 = new NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel1(this); + } + NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel1 result = this.fSecondLevel1; + // *** Start programmer edit section *** (FirstLevel.SecondLevel1 Get end) + + // *** End programmer edit section *** (FirstLevel.SecondLevel1 Get end) + return result; + } + set + { + // *** Start programmer edit section *** (FirstLevel.SecondLevel1 Set start) + + // *** End programmer edit section *** (FirstLevel.SecondLevel1 Set start) + this.fSecondLevel1 = value; + // *** Start programmer edit section *** (FirstLevel.SecondLevel1 Set end) + + // *** End programmer edit section *** (FirstLevel.SecondLevel1 Set end) + } + } + + /// + /// FirstLevel. + /// + // *** Start programmer edit section *** (FirstLevel.SecondLevel2 CustomAttributes) + + // *** End programmer edit section *** (FirstLevel.SecondLevel2 CustomAttributes) + [TypeUsage(new System.Type[] { + typeof(NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel2), + typeof(NewPlatform.Flexberry.ORM.ODataService.Tests.TestAssociation)})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel2 SecondLevel2 + { + get + { + // *** Start programmer edit section *** (FirstLevel.SecondLevel2 Get start) + + // *** End programmer edit section *** (FirstLevel.SecondLevel2 Get start) + if ((this.fSecondLevel2 == null)) + { + this.fSecondLevel2 = new NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel2(this); + } + NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel2 result = this.fSecondLevel2; + // *** Start programmer edit section *** (FirstLevel.SecondLevel2 Get end) + + // *** End programmer edit section *** (FirstLevel.SecondLevel2 Get end) + return result; + } + set + { + // *** Start programmer edit section *** (FirstLevel.SecondLevel2 Set start) + + // *** End programmer edit section *** (FirstLevel.SecondLevel2 Set start) + this.fSecondLevel2 = value; + // *** Start programmer edit section *** (FirstLevel.SecondLevel2 Set end) + + // *** End programmer edit section *** (FirstLevel.SecondLevel2 Set end) + } + } + + /// + /// мастеровая ссылка на шапку NewPlatform.Flexberry.ORM.ODataService.Tests.TestConfiguration. + /// + // *** Start programmer edit section *** (FirstLevel.TestConfiguration CustomAttributes) + + // *** End programmer edit section *** (FirstLevel.TestConfiguration CustomAttributes) + [Agregator()] + [NotNull()] + [PropertyStorage(new string[] { + "TestConfiguration"})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.TestConfiguration TestConfiguration + { + get + { + // *** Start programmer edit section *** (FirstLevel.TestConfiguration Get start) + + // *** End programmer edit section *** (FirstLevel.TestConfiguration Get start) + NewPlatform.Flexberry.ORM.ODataService.Tests.TestConfiguration result = this.fTestConfiguration; + // *** Start programmer edit section *** (FirstLevel.TestConfiguration Get end) + + // *** End programmer edit section *** (FirstLevel.TestConfiguration Get end) + return result; + } + set + { + // *** Start programmer edit section *** (FirstLevel.TestConfiguration Set start) + + // *** End programmer edit section *** (FirstLevel.TestConfiguration Set start) + this.fTestConfiguration = value; + // *** Start programmer edit section *** (FirstLevel.TestConfiguration Set end) + + // *** End programmer edit section *** (FirstLevel.TestConfiguration Set end) + } + } + } + + /// + /// Detail array of FirstLevel. + /// + // *** Start programmer edit section *** (DetailArrayDetailArrayOfFirstLevel CustomAttributes) + + // *** End programmer edit section *** (DetailArrayDetailArrayOfFirstLevel CustomAttributes) + public class DetailArrayOfFirstLevel : ICSSoft.STORMNET.DetailArray + { + + // *** Start programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfFirstLevel members) + + // *** End programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfFirstLevel members) + + + /// + /// Construct detail array. + /// + /// + /// Returns object with type FirstLevel by index. + /// + /// + /// Adds object with type FirstLevel. + /// + public DetailArrayOfFirstLevel(NewPlatform.Flexberry.ORM.ODataService.Tests.TestConfiguration fTestConfiguration) : + base(typeof(FirstLevel), ((ICSSoft.STORMNET.DataObject)(fTestConfiguration))) + { + } + + public NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel this[int index] + { + get + { + return ((NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel)(this.ItemByIndex(index))); + } + } + + public virtual void Add(NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel dataobject) + { + this.AddObject(((ICSSoft.STORMNET.DataObject)(dataobject))); + } + } +} + diff --git a/Tests/Objects/SecondLevel1.cs b/Tests/Objects/SecondLevel1.cs new file mode 100644 index 00000000..3645355f --- /dev/null +++ b/Tests/Objects/SecondLevel1.cs @@ -0,0 +1,150 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// SecondLevel1. + /// + // *** Start programmer edit section *** (SecondLevel1 CustomAttributes) + + // *** End programmer edit section *** (SecondLevel1 CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class SecondLevel1 : ICSSoft.STORMNET.DataObject + { + + private string fName; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel fFirstLevel; + + // *** Start programmer edit section *** (SecondLevel1 CustomMembers) + + // *** End programmer edit section *** (SecondLevel1 CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (SecondLevel1.Name CustomAttributes) + + // *** End programmer edit section *** (SecondLevel1.Name CustomAttributes) + [StrLen(255)] + public virtual string Name + { + get + { + // *** Start programmer edit section *** (SecondLevel1.Name Get start) + + // *** End programmer edit section *** (SecondLevel1.Name Get start) + string result = this.fName; + // *** Start programmer edit section *** (SecondLevel1.Name Get end) + + // *** End programmer edit section *** (SecondLevel1.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (SecondLevel1.Name Set start) + + // *** End programmer edit section *** (SecondLevel1.Name Set start) + this.fName = value; + // *** Start programmer edit section *** (SecondLevel1.Name Set end) + + // *** End programmer edit section *** (SecondLevel1.Name Set end) + } + } + + /// + /// мастеровая ссылка на шапку NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel. + /// + // *** Start programmer edit section *** (SecondLevel1.FirstLevel CustomAttributes) + + // *** End programmer edit section *** (SecondLevel1.FirstLevel CustomAttributes) + [Agregator()] + [NotNull()] + [PropertyStorage(new string[] { + "FirstLevel"})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel FirstLevel + { + get + { + // *** Start programmer edit section *** (SecondLevel1.FirstLevel Get start) + + // *** End programmer edit section *** (SecondLevel1.FirstLevel Get start) + NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel result = this.fFirstLevel; + // *** Start programmer edit section *** (SecondLevel1.FirstLevel Get end) + + // *** End programmer edit section *** (SecondLevel1.FirstLevel Get end) + return result; + } + set + { + // *** Start programmer edit section *** (SecondLevel1.FirstLevel Set start) + + // *** End programmer edit section *** (SecondLevel1.FirstLevel Set start) + this.fFirstLevel = value; + // *** Start programmer edit section *** (SecondLevel1.FirstLevel Set end) + + // *** End programmer edit section *** (SecondLevel1.FirstLevel Set end) + } + } + } + + /// + /// Detail array of SecondLevel1. + /// + // *** Start programmer edit section *** (DetailArrayDetailArrayOfSecondLevel1 CustomAttributes) + + // *** End programmer edit section *** (DetailArrayDetailArrayOfSecondLevel1 CustomAttributes) + public class DetailArrayOfSecondLevel1 : ICSSoft.STORMNET.DetailArray + { + + // *** Start programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel1 members) + + // *** End programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel1 members) + + + /// + /// Construct detail array. + /// + /// + /// Returns object with type SecondLevel1 by index. + /// + /// + /// Adds object with type SecondLevel1. + /// + public DetailArrayOfSecondLevel1(NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel fFirstLevel) : + base(typeof(SecondLevel1), ((ICSSoft.STORMNET.DataObject)(fFirstLevel))) + { + } + + public NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1 this[int index] + { + get + { + return ((NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1)(this.ItemByIndex(index))); + } + } + + public virtual void Add(NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1 dataobject) + { + this.AddObject(((ICSSoft.STORMNET.DataObject)(dataobject))); + } + } +} + diff --git a/Tests/Objects/SecondLevel2.cs b/Tests/Objects/SecondLevel2.cs new file mode 100644 index 00000000..3209fe77 --- /dev/null +++ b/Tests/Objects/SecondLevel2.cs @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// SecondLevel2. + /// + // *** Start programmer edit section *** (SecondLevel2 CustomAttributes) + + // *** End programmer edit section *** (SecondLevel2 CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class SecondLevel2 : ICSSoft.STORMNET.DataObject + { + + private string fName; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1 fSecondLevel1; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel fFirstLevel; + + // *** Start programmer edit section *** (SecondLevel2 CustomMembers) + + // *** End programmer edit section *** (SecondLevel2 CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (SecondLevel2.Name CustomAttributes) + + // *** End programmer edit section *** (SecondLevel2.Name CustomAttributes) + [StrLen(255)] + public virtual string Name + { + get + { + // *** Start programmer edit section *** (SecondLevel2.Name Get start) + + // *** End programmer edit section *** (SecondLevel2.Name Get start) + string result = this.fName; + // *** Start programmer edit section *** (SecondLevel2.Name Get end) + + // *** End programmer edit section *** (SecondLevel2.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (SecondLevel2.Name Set start) + + // *** End programmer edit section *** (SecondLevel2.Name Set start) + this.fName = value; + // *** Start programmer edit section *** (SecondLevel2.Name Set end) + + // *** End programmer edit section *** (SecondLevel2.Name Set end) + } + } + + /// + /// SecondLevel2. + /// + // *** Start programmer edit section *** (SecondLevel2.SecondLevel1 CustomAttributes) + + // *** End programmer edit section *** (SecondLevel2.SecondLevel1 CustomAttributes) + [PropertyStorage("SecondLevel1")] + [TypeUsage(new string[] { + "NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1", + "NewPlatform.Flexberry.ORM.ODataService.Tests.TestClass"})] + [NotNull()] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1 SecondLevel1 + { + get + { + // *** Start programmer edit section *** (SecondLevel2.SecondLevel1 Get start) + + // *** End programmer edit section *** (SecondLevel2.SecondLevel1 Get start) + NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1 result = this.fSecondLevel1; + // *** Start programmer edit section *** (SecondLevel2.SecondLevel1 Get end) + + // *** End programmer edit section *** (SecondLevel2.SecondLevel1 Get end) + return result; + } + set + { + // *** Start programmer edit section *** (SecondLevel2.SecondLevel1 Set start) + + // *** End programmer edit section *** (SecondLevel2.SecondLevel1 Set start) + this.fSecondLevel1 = value; + // *** Start programmer edit section *** (SecondLevel2.SecondLevel1 Set end) + + // *** End programmer edit section *** (SecondLevel2.SecondLevel1 Set end) + } + } + + /// + /// мастеровая ссылка на шапку NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel. + /// + // *** Start programmer edit section *** (SecondLevel2.FirstLevel CustomAttributes) + + // *** End programmer edit section *** (SecondLevel2.FirstLevel CustomAttributes) + [Agregator()] + [NotNull()] + [PropertyStorage(new string[] { + "FirstLevel"})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel FirstLevel + { + get + { + // *** Start programmer edit section *** (SecondLevel2.FirstLevel Get start) + + // *** End programmer edit section *** (SecondLevel2.FirstLevel Get start) + NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel result = this.fFirstLevel; + // *** Start programmer edit section *** (SecondLevel2.FirstLevel Get end) + + // *** End programmer edit section *** (SecondLevel2.FirstLevel Get end) + return result; + } + set + { + // *** Start programmer edit section *** (SecondLevel2.FirstLevel Set start) + + // *** End programmer edit section *** (SecondLevel2.FirstLevel Set start) + this.fFirstLevel = value; + // *** Start programmer edit section *** (SecondLevel2.FirstLevel Set end) + + // *** End programmer edit section *** (SecondLevel2.FirstLevel Set end) + } + } + } + + /// + /// Detail array of SecondLevel2. + /// + // *** Start programmer edit section *** (DetailArrayDetailArrayOfSecondLevel2 CustomAttributes) + + // *** End programmer edit section *** (DetailArrayDetailArrayOfSecondLevel2 CustomAttributes) + public class DetailArrayOfSecondLevel2 : ICSSoft.STORMNET.DetailArray + { + + // *** Start programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel2 members) + + // *** End programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfSecondLevel2 members) + + + /// + /// Construct detail array. + /// + /// + /// Returns object with type SecondLevel2 by index. + /// + /// + /// Adds object with type SecondLevel2. + /// + public DetailArrayOfSecondLevel2(NewPlatform.Flexberry.ORM.ODataService.Tests.FirstLevel fFirstLevel) : + base(typeof(SecondLevel2), ((ICSSoft.STORMNET.DataObject)(fFirstLevel))) + { + } + + public NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel2 this[int index] + { + get + { + return ((NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel2)(this.ItemByIndex(index))); + } + } + + public virtual void Add(NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel2 dataobject) + { + this.AddObject(((ICSSoft.STORMNET.DataObject)(dataobject))); + } + } +} + diff --git a/Tests/Objects/TestAssociation.cs b/Tests/Objects/TestAssociation.cs new file mode 100644 index 00000000..130a4707 --- /dev/null +++ b/Tests/Objects/TestAssociation.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// TestAssociation. + /// + // *** Start programmer edit section *** (TestAssociation CustomAttributes) + + // *** End programmer edit section *** (TestAssociation CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class TestAssociation : NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel2 + { + + private string fName2; + + // *** Start programmer edit section *** (TestAssociation CustomMembers) + + // *** End programmer edit section *** (TestAssociation CustomMembers) + + + /// + /// Name2. + /// + // *** Start programmer edit section *** (TestAssociation.Name2 CustomAttributes) + + // *** End programmer edit section *** (TestAssociation.Name2 CustomAttributes) + [StrLen(255)] + public virtual string Name2 + { + get + { + // *** Start programmer edit section *** (TestAssociation.Name2 Get start) + + // *** End programmer edit section *** (TestAssociation.Name2 Get start) + string result = this.fName2; + // *** Start programmer edit section *** (TestAssociation.Name2 Get end) + + // *** End programmer edit section *** (TestAssociation.Name2 Get end) + return result; + } + set + { + // *** Start programmer edit section *** (TestAssociation.Name2 Set start) + + // *** End programmer edit section *** (TestAssociation.Name2 Set start) + this.fName2 = value; + // *** Start programmer edit section *** (TestAssociation.Name2 Set end) + + // *** End programmer edit section *** (TestAssociation.Name2 Set end) + } + } + } +} + diff --git a/Tests/Objects/TestClass.cs b/Tests/Objects/TestClass.cs new file mode 100644 index 00000000..9981ec17 --- /dev/null +++ b/Tests/Objects/TestClass.cs @@ -0,0 +1,106 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// TestClass. + /// + // *** Start programmer edit section *** (TestClass CustomAttributes) + + // *** End programmer edit section *** (TestClass CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class TestClass : NewPlatform.Flexberry.ORM.ODataService.Tests.SecondLevel1 + { + + private NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfThirdLevel fThirdLevel; + + // *** Start programmer edit section *** (TestClass CustomMembers) + + // *** End programmer edit section *** (TestClass CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (TestClass.Name CustomAttributes) + + // *** End programmer edit section *** (TestClass.Name CustomAttributes) + [StrLen(255)] + public override string Name + { + get + { + // *** Start programmer edit section *** (TestClass.Name Get start) + + // *** End programmer edit section *** (TestClass.Name Get start) + string result = base.Name; + // *** Start programmer edit section *** (TestClass.Name Get end) + + // *** End programmer edit section *** (TestClass.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (TestClass.Name Set start) + + // *** End programmer edit section *** (TestClass.Name Set start) + base.Name = value; + // *** Start programmer edit section *** (TestClass.Name Set end) + + // *** End programmer edit section *** (TestClass.Name Set end) + } + } + + /// + /// TestClass. + /// + // *** Start programmer edit section *** (TestClass.ThirdLevel CustomAttributes) + + // *** End programmer edit section *** (TestClass.ThirdLevel CustomAttributes) + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfThirdLevel ThirdLevel + { + get + { + // *** Start programmer edit section *** (TestClass.ThirdLevel Get start) + + // *** End programmer edit section *** (TestClass.ThirdLevel Get start) + if ((this.fThirdLevel == null)) + { + this.fThirdLevel = new NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfThirdLevel(this); + } + NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfThirdLevel result = this.fThirdLevel; + // *** Start programmer edit section *** (TestClass.ThirdLevel Get end) + + // *** End programmer edit section *** (TestClass.ThirdLevel Get end) + return result; + } + set + { + // *** Start programmer edit section *** (TestClass.ThirdLevel Set start) + + // *** End programmer edit section *** (TestClass.ThirdLevel Set start) + this.fThirdLevel = value; + // *** Start programmer edit section *** (TestClass.ThirdLevel Set end) + + // *** End programmer edit section *** (TestClass.ThirdLevel Set end) + } + } + } +} + diff --git a/Tests/Objects/TestConfiguration.cs b/Tests/Objects/TestConfiguration.cs new file mode 100644 index 00000000..bd3d0ea4 --- /dev/null +++ b/Tests/Objects/TestConfiguration.cs @@ -0,0 +1,108 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// TestConfiguration. + /// + // *** Start programmer edit section *** (TestConfiguration CustomAttributes) + + // *** End programmer edit section *** (TestConfiguration CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class TestConfiguration : ICSSoft.STORMNET.DataObject + { + + private string fName; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfFirstLevel fFirstLevel; + + // *** Start programmer edit section *** (TestConfiguration CustomMembers) + + // *** End programmer edit section *** (TestConfiguration CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (TestConfiguration.Name CustomAttributes) + + // *** End programmer edit section *** (TestConfiguration.Name CustomAttributes) + [StrLen(255)] + public virtual string Name + { + get + { + // *** Start programmer edit section *** (TestConfiguration.Name Get start) + + // *** End programmer edit section *** (TestConfiguration.Name Get start) + string result = this.fName; + // *** Start programmer edit section *** (TestConfiguration.Name Get end) + + // *** End programmer edit section *** (TestConfiguration.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (TestConfiguration.Name Set start) + + // *** End programmer edit section *** (TestConfiguration.Name Set start) + this.fName = value; + // *** Start programmer edit section *** (TestConfiguration.Name Set end) + + // *** End programmer edit section *** (TestConfiguration.Name Set end) + } + } + + /// + /// TestConfiguration. + /// + // *** Start programmer edit section *** (TestConfiguration.FirstLevel CustomAttributes) + + // *** End programmer edit section *** (TestConfiguration.FirstLevel CustomAttributes) + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfFirstLevel FirstLevel + { + get + { + // *** Start programmer edit section *** (TestConfiguration.FirstLevel Get start) + + // *** End programmer edit section *** (TestConfiguration.FirstLevel Get start) + if ((this.fFirstLevel == null)) + { + this.fFirstLevel = new NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfFirstLevel(this); + } + NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfFirstLevel result = this.fFirstLevel; + // *** Start programmer edit section *** (TestConfiguration.FirstLevel Get end) + + // *** End programmer edit section *** (TestConfiguration.FirstLevel Get end) + return result; + } + set + { + // *** Start programmer edit section *** (TestConfiguration.FirstLevel Set start) + + // *** End programmer edit section *** (TestConfiguration.FirstLevel Set start) + this.fFirstLevel = value; + // *** Start programmer edit section *** (TestConfiguration.FirstLevel Set end) + + // *** End programmer edit section *** (TestConfiguration.FirstLevel Set end) + } + } + } +} + diff --git a/Tests/Objects/TestMaster.cs b/Tests/Objects/TestMaster.cs index f894f6b5..0d957b26 100644 --- a/Tests/Objects/TestMaster.cs +++ b/Tests/Objects/TestMaster.cs @@ -1,20 +1,17 @@ //------------------------------------------------------------------------------ // -// Этот код создан программой. -// Исполняемая версия:4.0.30319.42000 +// This code was generated by a tool. // -// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае -// повторной генерации кода. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // //------------------------------------------------------------------------------ namespace NewPlatform.Flexberry.ORM.ODataService.Tests { - using System; - using System.Xml; using ICSSoft.STORMNET; - - + + // *** Start programmer edit section *** (Using statements) // *** End programmer edit section *** (Using statements) @@ -34,16 +31,16 @@ namespace NewPlatform.Flexberry.ORM.ODataService.Tests "TestMasterName"})] public class TestMaster : ICSSoft.STORMNET.DataObject { - + private string fTestMasterName; - + private NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfTestDetailWithCicle fTestDetailWithCicle; - + // *** Start programmer edit section *** (TestMaster CustomMembers) // *** End programmer edit section *** (TestMaster CustomMembers) - + /// /// TestMasterName. /// @@ -75,7 +72,7 @@ public virtual string TestMasterName // *** End programmer edit section *** (TestMaster.TestMasterName Set end) } } - + /// /// TestMaster. /// @@ -110,13 +107,13 @@ public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfTestDet // *** End programmer edit section *** (TestMaster.TestDetailWithCicle Set end) } } - + /// /// Class views container. /// public class Views { - + /// /// "TestMasterE" view. /// @@ -127,7 +124,7 @@ public static ICSSoft.STORMNET.View TestMasterE return ICSSoft.STORMNET.Information.GetView("TestMasterE", typeof(NewPlatform.Flexberry.ORM.ODataService.Tests.TestMaster)); } } - + /// /// "TestMasterL" view. /// @@ -141,3 +138,4 @@ public static ICSSoft.STORMNET.View TestMasterL } } } + diff --git a/Tests/Objects/ThirdLevel.cs b/Tests/Objects/ThirdLevel.cs new file mode 100644 index 00000000..448915d5 --- /dev/null +++ b/Tests/Objects/ThirdLevel.cs @@ -0,0 +1,150 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NewPlatform.Flexberry.ORM.ODataService.Tests +{ + using ICSSoft.STORMNET; + + + // *** Start programmer edit section *** (Using statements) + + // *** End programmer edit section *** (Using statements) + + + /// + /// ThirdLevel. + /// + // *** Start programmer edit section *** (ThirdLevel CustomAttributes) + + // *** End programmer edit section *** (ThirdLevel CustomAttributes) + [AutoAltered()] + [AccessType(ICSSoft.STORMNET.AccessType.none)] + public class ThirdLevel : ICSSoft.STORMNET.DataObject + { + + private string fName; + + private NewPlatform.Flexberry.ORM.ODataService.Tests.TestClass fTestClass; + + // *** Start programmer edit section *** (ThirdLevel CustomMembers) + + // *** End programmer edit section *** (ThirdLevel CustomMembers) + + + /// + /// Name. + /// + // *** Start programmer edit section *** (ThirdLevel.Name CustomAttributes) + + // *** End programmer edit section *** (ThirdLevel.Name CustomAttributes) + [StrLen(255)] + public virtual string Name + { + get + { + // *** Start programmer edit section *** (ThirdLevel.Name Get start) + + // *** End programmer edit section *** (ThirdLevel.Name Get start) + string result = this.fName; + // *** Start programmer edit section *** (ThirdLevel.Name Get end) + + // *** End programmer edit section *** (ThirdLevel.Name Get end) + return result; + } + set + { + // *** Start programmer edit section *** (ThirdLevel.Name Set start) + + // *** End programmer edit section *** (ThirdLevel.Name Set start) + this.fName = value; + // *** Start programmer edit section *** (ThirdLevel.Name Set end) + + // *** End programmer edit section *** (ThirdLevel.Name Set end) + } + } + + /// + /// мастеровая ссылка на шапку NewPlatform.Flexberry.ORM.ODataService.Tests.TestClass. + /// + // *** Start programmer edit section *** (ThirdLevel.TestClass CustomAttributes) + + // *** End programmer edit section *** (ThirdLevel.TestClass CustomAttributes) + [Agregator()] + [NotNull()] + [PropertyStorage(new string[] { + "TestClass"})] + public virtual NewPlatform.Flexberry.ORM.ODataService.Tests.TestClass TestClass + { + get + { + // *** Start programmer edit section *** (ThirdLevel.TestClass Get start) + + // *** End programmer edit section *** (ThirdLevel.TestClass Get start) + NewPlatform.Flexberry.ORM.ODataService.Tests.TestClass result = this.fTestClass; + // *** Start programmer edit section *** (ThirdLevel.TestClass Get end) + + // *** End programmer edit section *** (ThirdLevel.TestClass Get end) + return result; + } + set + { + // *** Start programmer edit section *** (ThirdLevel.TestClass Set start) + + // *** End programmer edit section *** (ThirdLevel.TestClass Set start) + this.fTestClass = value; + // *** Start programmer edit section *** (ThirdLevel.TestClass Set end) + + // *** End programmer edit section *** (ThirdLevel.TestClass Set end) + } + } + } + + /// + /// Detail array of ThirdLevel. + /// + // *** Start programmer edit section *** (DetailArrayDetailArrayOfThirdLevel CustomAttributes) + + // *** End programmer edit section *** (DetailArrayDetailArrayOfThirdLevel CustomAttributes) + public class DetailArrayOfThirdLevel : ICSSoft.STORMNET.DetailArray + { + + // *** Start programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfThirdLevel members) + + // *** End programmer edit section *** (NewPlatform.Flexberry.ORM.ODataService.Tests.DetailArrayOfThirdLevel members) + + + /// + /// Construct detail array. + /// + /// + /// Returns object with type ThirdLevel by index. + /// + /// + /// Adds object with type ThirdLevel. + /// + public DetailArrayOfThirdLevel(NewPlatform.Flexberry.ORM.ODataService.Tests.TestClass fTestClass) : + base(typeof(ThirdLevel), ((ICSSoft.STORMNET.DataObject)(fTestClass))) + { + } + + public NewPlatform.Flexberry.ORM.ODataService.Tests.ThirdLevel this[int index] + { + get + { + return ((NewPlatform.Flexberry.ORM.ODataService.Tests.ThirdLevel)(this.ItemByIndex(index))); + } + } + + public virtual void Add(NewPlatform.Flexberry.ORM.ODataService.Tests.ThirdLevel dataobject) + { + this.AddObject(((ICSSoft.STORMNET.DataObject)(dataobject))); + } + } +} + From b55156f9ff9a165ff352b82b6b2e8519372dd28d Mon Sep 17 00:00:00 2001 From: tosotova Date: Tue, 13 Feb 2024 11:14:29 +0500 Subject: [PATCH 2/6] Added test for situation of difficult batch --- .../CRUD/BatchTest.cs | 261 ++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs diff --git a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs new file mode 100644 index 00000000..2b57a3c7 --- /dev/null +++ b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs @@ -0,0 +1,261 @@ +namespace NewPlatform.Flexberry.ORM.ODataService.Tests.CRUD.Update +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + using ICSSoft.STORMNET; + using ICSSoft.STORMNET.Business.LINQProvider; + using ICSSoft.STORMNET.KeyGen; + using NewPlatform.Flexberry.ORM.ODataService.Tests.Extensions; + using NewPlatform.Flexberry.ORM.ODataService.Tests.Helpers; + using Xunit; + using View = ICSSoft.STORMNET.View; + + /// + /// The class of tests for CRUD operations at Batch form. + /// There are extra batch tests at . + /// + public class BatchTest : BaseODataServiceIntegratedTest + { +#if NETCOREAPP + /// + /// Default constructor. + /// + /// Factory for application. + /// Output for debug information. + public BatchTest(CustomWebApplicationFactory factory, Xunit.Abstractions.ITestOutputHelper output) + : base(factory, output) + { + } +#endif + + /// + /// Test batch update of master-class with class at the same time. + /// It checks that dataobject cache is not crashed. + /// + [Fact] + public void UpdateMasterAndClassTest() + { + /* Суть теста в том, что сначала в батч-запрос идёт мастер, а далее идёт сам объект со ссылкой на мастера. + * Ссылка на мастера не меняется при этом. + * Необходимо, чтобы при последовательной обработке батчей мастер не был перевычитан и его значение обновилось корректно. + */ + ActODataService(args => + { + // Arrange. + string[] porodaPropertiesNames = + { + Information.ExtractPropertyPath<Порода>(x => x.__PrimaryKey), + Information.ExtractPropertyPath<Порода>(x => x.Название), + }; + string[] koshkaPropertiesNames = + { + Information.ExtractPropertyPath<Кошка>(x => x.__PrimaryKey), + Information.ExtractPropertyPath<Кошка>(x => x.Кличка), + }; + View porodaDynamicView = new View(new ViewAttribute("porodaDynamicView", porodaPropertiesNames), typeof(Порода)); + View koshkaDynamicView = new View(new ViewAttribute("koshkaDynamicView", koshkaPropertiesNames), typeof(Кошка)); + + const string InitialName = "Initial"; + const string OtherName = "Other"; + Порода poroda = new Порода() { Название = InitialName }; + Кошка koshka = new Кошка() { Кличка = InitialName, Порода = poroda}; + args.DataService.UpdateObject(koshka); + + Порода poroda1 = args.DataService.Query<Порода>(porodaDynamicView).FirstOrDefault(x => x.__PrimaryKey == poroda.__PrimaryKey); + Кошка koshka1 = args.DataService.Query<Кошка>(koshkaDynamicView).FirstOrDefault(x => x.__PrimaryKey == koshka.__PrimaryKey); + Assert.NotNull(poroda1); + Assert.NotNull(koshka1); + + poroda.Название = OtherName; + koshka.Кличка = OtherName; + + string requestJsonDatakoshka = koshka.ToJson(koshkaDynamicView, args.Token.Model); + DataObjectDictionary objJsonKoshka = DataObjectDictionary.Parse(requestJsonDatakoshka, koshkaDynamicView, args.Token.Model); + + objJsonKoshka.Add( + $"{nameof(Кошка.Порода)}@odata.bind", + string.Format( + "{0}({1})", + args.Token.Model.GetEdmEntitySet(typeof(Порода)).Name, + ((KeyGuid)poroda.__PrimaryKey).Guid.ToString("D"))); + + requestJsonDatakoshka = objJsonKoshka.Serialize(); + + const string baseUrl = "http://localhost/odata"; + string[] changesets = new[] // Важно, чтобы сначала шёл мастер, потом объект, имеющий на него ссылку. + { + + CreateChangeset( + $"{baseUrl}/{args.Token.Model.GetEdmEntitySet(typeof(Порода)).Name}", + poroda.ToJson(porodaDynamicView, args.Token.Model), + poroda), + CreateChangeset( + $"{baseUrl}/{args.Token.Model.GetEdmEntitySet(typeof(Кошка)).Name}", + requestJsonDatakoshka, + koshka), + }; + + // Act. + HttpRequestMessage batchRequest = CreateBatchRequest(baseUrl, changesets); + using (HttpResponseMessage response = args.HttpClient.SendAsync(batchRequest).Result) + { + // Assert. + CheckODataBatchResponseStatusCode(response, new HttpStatusCode[] { HttpStatusCode.OK, HttpStatusCode.OK }); + Порода poroda2 = args.DataService.Query<Порода>(porodaDynamicView).FirstOrDefault(x => x.__PrimaryKey == poroda.__PrimaryKey); + Кошка koshka2 = args.DataService.Query<Кошка>(koshkaDynamicView).FirstOrDefault(x => x.__PrimaryKey == koshka.__PrimaryKey); + Assert.NotNull(poroda2); + Assert.NotNull(koshka2); + Assert.Equal(OtherName, poroda2.Название); + Assert.Equal(OtherName, koshka2.Кличка); + } + }); + } + + /// + /// Test batch update with inheritance. + /// It checks that dataobject cache is not crashed. + /// + [Fact] + public void UpdateWithInheritanceAndDetailsTest() + { + /* Суть теста в том, что есть класс А, у него детейл Б, у которого есть наследник В. + * При загрузке объекта класса А подгрузятся его детейлы, однако они будут подгружены по представлению, которое соответствует классу Б, даже если детейлы класса В. + * Таким образом, в кэше окажутся объекты класса В, которые загружены только по свойствам Б. Раз не все свойства подгружены, то состояние LightLoaded. + * Догружать необходимо только те свойства, что ещё не загружались (потому что загруженные уже могут быть изменены). + * + * Необходимо, чтобы при последовательной обработке батча все значения обновились корректно. + */ + ActODataService(args => + { + // Arrange. + const string InitialName = "Initial"; + const string OtherName = "Other"; + TestConfiguration testConfiguration = new TestConfiguration() { Name = InitialName }; + FirstLevel first = new FirstLevel() { Name = InitialName, TestConfiguration = testConfiguration }; + TestClass second1 = new TestClass { Name = InitialName, FirstLevel = first }; + TestAssociation second2 = new TestAssociation { Name = InitialName, FirstLevel = first, SecondLevel1 = second1 }; + ThirdLevel third = new ThirdLevel { Name = InitialName, TestClass = second1 }; + DataObject[] updateObjects = new DataObject[] { testConfiguration, first, second1, second2, third }; + args.DataService.UpdateObjects(ref updateObjects); + + second2.Name = OtherName; // Изменение значения детейла одного типа, который имеет мастеровую ссылку на детейл второго типа (второй тип имеет детейл собственный). + ThirdLevel third2 = new ThirdLevel { Name = OtherName, TestClass = second1 }; // Добавление детейлов в детейл второго типа. + + string[] firstPropertiesNames = + { + Information.ExtractPropertyPath(x => x.__PrimaryKey), + Information.ExtractPropertyPath(x => x.Name), + }; + View firstLevelDynamicView = new View(new ViewAttribute("firstLevelDynamicView", firstPropertiesNames), typeof(FirstLevel)); + + string[] second1PropertiesNames = + { + Information.ExtractPropertyPath(x => x.__PrimaryKey), + Information.ExtractPropertyPath(x => x.Name), + }; + View second1DynamicView = new View(new ViewAttribute("second1DynamicView", second1PropertiesNames), typeof(TestClass)); + + string[] second2PropertiesNames = + { + Information.ExtractPropertyPath(x => x.__PrimaryKey), + Information.ExtractPropertyPath(x => x.Name), + }; + View second2DynamicView = new View(new ViewAttribute("second2DynamicView", second2PropertiesNames), typeof(TestAssociation)); + + string[] thirdPropertiesNames = + { + Information.ExtractPropertyPath(x => x.__PrimaryKey), + Information.ExtractPropertyPath(x => x.Name), + }; + View thirdLevelDynamicView = new View(new ViewAttribute("thirdDynamicView", thirdPropertiesNames), typeof(ThirdLevel)); + + // Операция изменения детейла второго типа (он попадает в батч-запрос как агрегатор к добавляемому детейлу второго уровня). + string requestJsonDataSecond1 = second1.ToJson(second1DynamicView, args.Token.Model); + DataObjectDictionary objJsonSecond1 = DataObjectDictionary.Parse(requestJsonDataSecond1, second1DynamicView, args.Token.Model); + objJsonSecond1.Add( // Добавляется ссылка на агрегатор. + $"{nameof(TestClass.FirstLevel)}@odata.bind", + string.Format("{0}({1})", args.Token.Model.GetEdmEntitySet(typeof(FirstLevel)).Name, ((KeyGuid)first.__PrimaryKey).Guid.ToString("D"))); + requestJsonDataSecond1 = objJsonSecond1.Serialize(); + + // Операция вставки детейла второго уровня. + string requestJsonDataThird2 = third2.ToJson(thirdLevelDynamicView, args.Token.Model); + DataObjectDictionary objJsonThird2 = DataObjectDictionary.Parse(requestJsonDataThird2, thirdLevelDynamicView, args.Token.Model); + objJsonThird2.Add( // Добавляется ссылка на агрегатор. + $"{nameof(ThirdLevel.TestClass)}@odata.bind", + string.Format("{0}({1})", args.Token.Model.GetEdmEntitySet(typeof(TestClass)).Name, ((KeyGuid)second1.__PrimaryKey).Guid.ToString("D"))); + requestJsonDataThird2 = objJsonThird2.Serialize(); + + // Операция изменения детейла первого типа. + string requestJsonDataSecond2 = second2.ToJson(second2DynamicView, args.Token.Model); + DataObjectDictionary objJsonSecond2 = DataObjectDictionary.Parse(requestJsonDataSecond2, second2DynamicView, args.Token.Model); + objJsonSecond2.Add( // Добавляется ссылка на агрегатор. + $"{nameof(TestAssociation.FirstLevel)}@odata.bind", + string.Format("{0}({1})", args.Token.Model.GetEdmEntitySet(typeof(FirstLevel)).Name, ((KeyGuid)first.__PrimaryKey).Guid.ToString("D"))); + objJsonSecond2.Add( // Добавляется ссылка мастеровая на другой детейл. + $"{nameof(TestAssociation.SecondLevel1)}@odata.bind", + string.Format("{0}({1})", args.Token.Model.GetEdmEntitySet(typeof(TestClass)).Name, ((KeyGuid)second1.__PrimaryKey).Guid.ToString("D"))); + requestJsonDataSecond2 = objJsonSecond2.Serialize(); + + const string baseUrl = "http://localhost/odata"; + string[] changesets = new[] + { + + CreateChangeset( + $"{baseUrl}/{args.Token.Model.GetEdmEntitySet(typeof(TestClass)).Name}", + requestJsonDataSecond1, + second1), + CreateChangeset( + $"{baseUrl}/{args.Token.Model.GetEdmEntitySet(typeof(ThirdLevel)).Name}", + requestJsonDataThird2, + third2), + CreateChangeset( + $"{baseUrl}/{args.Token.Model.GetEdmEntitySet(typeof(TestAssociation)).Name}", + requestJsonDataSecond2, + second2), + }; + HttpRequestMessage batchRequest = CreateBatchRequest(baseUrl, changesets); + + // Код для удобства отлавливания исключений. + args.Token.Events.CallbackAfterInternalServerError = (Exception exception, ref HttpStatusCode code) => + { + Exception currentException = exception; + + while (currentException != null) + { + currentException = currentException.InnerException; + } + + return exception; + }; + + // Act. + using (HttpResponseMessage response = args.HttpClient.SendAsync(batchRequest).Result) + { + // Assert. + CheckODataBatchResponseStatusCode(response, new HttpStatusCode[] { HttpStatusCode.OK, HttpStatusCode.OK }); + + string[] thirdPropertiesNames2 = + { + Information.ExtractPropertyPath(x => x.__PrimaryKey), + Information.ExtractPropertyPath(x => x.Name), + Information.ExtractPropertyPath(x => x.TestClass), + }; + View thirdLevelDynamicView2 = new View(new ViewAttribute("thirdDynamicView2", thirdPropertiesNames2), typeof(ThirdLevel)); + List thirdLevelList = args.DataService.Query(thirdLevelDynamicView2).Where(x => x.TestClass.__PrimaryKey == second1.__PrimaryKey).ToList(); + Assert.NotNull(thirdLevelList); + Assert.True(thirdLevelList.Any()); + Assert.Equal(2, thirdLevelList.Count); + + TestAssociation checkAssociation = args.DataService.Query(second2DynamicView).FirstOrDefault(x => x.__PrimaryKey == second2.__PrimaryKey); + Assert.NotNull(checkAssociation); + Assert.Equal(OtherName, checkAssociation.Name); + } + }); + } + } +} + From 3fdcda21e3ce4e38b31140d966798d0666a40fe4 Mon Sep 17 00:00:00 2001 From: tosotova Date: Wed, 14 Feb 2024 09:01:36 +0500 Subject: [PATCH 3/6] Correction of master and detail loading without cache damage --- .../DataObjectController.ModifyData.cs | 10 +- .../Extensions/DataServiceExtensions.cs | 167 +++++++++++++++++- 2 files changed, 170 insertions(+), 7 deletions(-) diff --git a/NewPlatform.Flexberry.ORM.ODataService/Controllers/DataObjectController.ModifyData.cs b/NewPlatform.Flexberry.ORM.ODataService/Controllers/DataObjectController.ModifyData.cs index 074b815d..9b355276 100644 --- a/NewPlatform.Flexberry.ORM.ODataService/Controllers/DataObjectController.ModifyData.cs +++ b/NewPlatform.Flexberry.ORM.ODataService/Controllers/DataObjectController.ModifyData.cs @@ -722,7 +722,13 @@ private DataObject ReturnDataObject(Type objType, object keyValue) && dataObjectFromCache.GetLoadingState() != LoadingState.Loaded) { // Для обратной совместимости сравним перечень загруженных свойств и свойств в представлении. - // TODO: удалить эту проверку после стабилизации версии 5.1.0. + /* Данный код срабатывает, например, если в кэше был объект, который загрузился только на уровне первичного ключа. + * + * Данный код также срабатывает в следующей ситуации: есть класс А, у него детейл Б, у которого есть наследник В. + * При загрузке объекта класса А подгрузятся его детейлы, однако они будут подгружены по представлению, которое соответствует классу Б, даже если детейлы класса В. + * Таким образом, в кэше окажутся объекты класса В, которые загружены только по свойствам Б. Раз не все свойства подгружены, то состояние LightLoaded. + * Догружать необходимо только те свойства, что ещё не загружались (потому что загруженные уже могут быть изменены). + */ string[] loadedProps = dataObjectFromCache.GetLoadedProperties(); IEnumerable ownProps = view.Properties.Where(p => !p.Name.Contains('.')); if (!ownProps.All(p => loadedProps.Contains(p.Name))) @@ -731,7 +737,7 @@ private DataObject ReturnDataObject(Type objType, object keyValue) View miniView = view.Clone(); DetailInView[] miniViewDetails = miniView.Details; miniView.Details = new DetailInView[0]; - _dataService.LoadObject(miniView, dataObjectFromCache, false, true, DataObjectCache); + _dataService.SafeLoadWithMasters(miniView, dataObjectFromCache, DataObjectCache); if (miniViewDetails.Length > 0) { diff --git a/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs b/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs index 9d0ddd9b..9b29e2e3 100644 --- a/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs +++ b/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs @@ -34,6 +34,53 @@ public static object Execute(this SQLDataService dataService, Type dataObjectTyp return queryProvider.Execute(expression); } + /// + /// Загрузка объекта с его мастерами (объект должен быть не изменнённый и не до конца загруженный). + /// С мастерами необходимо обращаться аккуратно: если в кэше уже есть мастер, то нужно эту ситуацию разрешить, + /// поскольку иначе стандартная загрузка перетрёт данные мастера в кэше (и если он там изменён, то все изменения будут потеряны). + /// + /// Экземпляр сервиса данных. + /// Представление объекта с мастерами. + /// Объект данных, в который будет производиться загрузка. + /// Текущий кэш объектов данных (в данном кэше ранее существующие там объекты не должны быть перетёрты). + public static void SafeLoadWithMasters( + this IDataService dataService, View view, ICSSoft.STORMNET.DataObject dobjectFromCache, DataObjectCache dataObjectCache) + { + if (dataService == null) + { + throw new ArgumentNullException(nameof(dataService)); + } + + if (view == null) + { + throw new ArgumentNullException(nameof(view)); + } + + if (dobjectFromCache == null) + { + throw new ArgumentNullException(nameof(dobjectFromCache)); + } + + if (dataObjectCache == null) + { + throw new ArgumentNullException(nameof(dataObjectCache)); + } + + // Прогружается пустой объект, чтобы избежать риска перетирания основного. + DataObject createdObject = (DataObject)Activator.CreateInstance(dobjectFromCache.GetType()); + createdObject.SetExistObjectPrimaryKey(dobjectFromCache.__PrimaryKey); + + // Используется отдельный кэш, чтобы не перетереть данные в основном кэше. + DataObjectCache specialCache = new DataObjectCache(); + specialCache.StartCaching(false); + specialCache.AddDataObject(createdObject); + dataService.LoadObject(view, createdObject, false, true, specialCache); + specialCache.StopCaching(); + + // Перенос данных из одного объекта в другой. + ProperUpdateOfObject(dobjectFromCache, createdObject, dataObjectCache, specialCache); + } + /// /// Загрузка детейлов с сохранением состояния изменения. /// @@ -122,20 +169,19 @@ public static void SafeLoadDetails(this IDataService dataService, View view, ILi lcs.LimitFunction = FunctionBuilder.BuildIn(agregatorPropertyName, SQLWhereLanguageDef.LanguageDef.GetObjectTypeForNetType(agregatorKeyType), keys); // Нужно соблюсти единственность инстанций агрегаторов при вычитке, поэтому реализуем отдельный кеш. Смешивать с кешем dataObjectCache нельзя, поскольку в предстоящей выборке будут те же самые детейлы (значения в кеше затрутся). + // Агрегаторы в кэш не помещаем. От помещения агрегаторов в кэш возникают неконтролируемые сбои основного кэша. DataObjectCache agregatorCache = new DataObjectCache(); agregatorCache.StartCaching(false); - foreach (DataObject agregator in agregators) - { - agregatorCache.AddDataObject(agregator); - } // Вычитываются детейлы одного типа, но для нескольких инстанций агрегаторов (оптимизируем количество SQL-запросов). DataObject[] loadedDetails = dataService.LoadObjects(lcs, agregatorCache); agregatorCache.StopCaching(); + Dictionary extraCacheForAgregators = new Dictionary(); foreach (DataObject agregator in agregators) { agregator.AddLoadedProperties(detailInView.Name); + extraCacheForAgregators.Add(agregator.__PrimaryKey, agregator); } // Ввиду того, что агрегаторы нам пришли готовые с пустыми коллекциями детейлов, заполняем детейлы по агрегаторам значениями из кеша или из базы. @@ -143,7 +189,8 @@ public static void SafeLoadDetails(this IDataService dataService, View view, ILi List toLoadSecondDetails = new List(); foreach (DataObject loadedDetail in loadedDetails) { - DataObject agregator = (DataObject)Information.GetPropValueByName(loadedDetail, agregatorPropertyName); + DataObject agregatorTemp = (DataObject)Information.GetPropValueByName(loadedDetail, agregatorPropertyName); + DataObject agregator = extraCacheForAgregators[agregatorTemp.__PrimaryKey]; object detailPrimaryKey = loadedDetail.__PrimaryKey; DataObject detailFromCache = dataObjectCache.GetLivingDataObject(loadedDetail.GetType(), detailPrimaryKey); @@ -226,5 +273,115 @@ public static void AddDetail(this DataObject agregator, DataObject detail) LogService.LogWarn($"Detail type {detailType.AssemblyQualifiedName} not found in agregator of type {agregatorType.AssemblyQualifiedName}."); } } + + + /// + /// Перенос означенных свойств из свежезагруженного объекта в основной, расположенный в основном кэше. + /// + /// Основной объект, куда необходимо копировать значения свойств. + /// Свежезагруженный объект. + /// Основной кэш. + /// Локальный кэш, куда была выполнена свежая прогрузка. + private static void ProperUpdateOfObject(DataObject currentObject, DataObject loadedObjectLocal, DataObjectCache dataObjectCache, DataObjectCache dataObjectCacheLocal) + { + if (currentObject == null) + { + throw new ArgumentNullException(nameof(currentObject)); + } + + if (loadedObjectLocal == null) + { + throw new ArgumentNullException(nameof(loadedObjectLocal)); + } + + if (dataObjectCache == null) + { + throw new ArgumentNullException(nameof(dataObjectCache)); + } + + if (dataObjectCacheLocal == null) + { + throw new ArgumentNullException(nameof(dataObjectCacheLocal)); + } + + // Перенос значений свойств объекта (в том числе могут быть мастера). Если мастера означены, то перенос свойств мастера производится далее. + List localObjectLoadedProps = loadedObjectLocal.GetLoadedPropertiesList(); + List currentObjectLoadedProps = currentObject.GetLoadedPropertiesList(); + List notLoadedForActual = localObjectLoadedProps.Except(currentObjectLoadedProps).ToList(); + DataObject currentDataCopy = currentObject.GetDataCopy(); + foreach (string notLoadedPropName in notLoadedForActual) + { + object propValue = Information.GetPropValueByName(loadedObjectLocal, notLoadedPropName); + Information.SetPropValueByName(currentObject, notLoadedPropName, propValue); + currentObject.AddLoadedProperties(notLoadedPropName); + Information.SetPropValueByName(currentDataCopy, notLoadedPropName, propValue); + } + + // Ещё могут быть частично загруженные мастера. + ProperCacheUpdateForOneObject(dataObjectCache, dataObjectCacheLocal, loadedObjectLocal, true); + } + + /// + /// Обновление кэша по свежезагруженному объекту. + /// + /// Текущий основной кэш объектов. + /// Вспомогательный кэш, куда загружался объект. + /// Свежезагруженный объект, по которому обновляется основной кэш. + /// Флаг, определяющий, что в кэш уже добавлен свежезагруженный объект. + private static void ProperCacheUpdateForOneObject(DataObjectCache dataObjectCacheActual, DataObjectCache dataObjectCacheWithMasters, DataObject loadedDataObject, bool loadedObjectsAdded) + { + if (dataObjectCacheActual == null) + { + throw new ArgumentNullException(nameof(dataObjectCacheActual)); + } + + if (dataObjectCacheWithMasters == null) + { + throw new ArgumentNullException(nameof(dataObjectCacheWithMasters)); + } + + if (loadedDataObject == null) + { + return; + } + + if (!loadedObjectsAdded) + { + dataObjectCacheActual.AddDataObject(loadedDataObject); + } + + Type dobjType = typeof(DataObject); + Type currentType = loadedDataObject.GetType(); + List loadedProperties = loadedDataObject.GetLoadedPropertiesList(); + foreach (string currentPropertyName in loadedProperties) + { + Type currentPropertyType = Information.GetPropertyType(currentType, currentPropertyName); + if (currentPropertyType.IsSubclassOf(dobjType)) // Выбираем у текущего объекта ссылки на мастеров. + { + DataObject currentMaster = (DataObject)Information.GetPropValueByName(loadedDataObject, currentPropertyName); + if (currentMaster != null) + { + // Типы currentPropertyType и currentMaster.GetType() могут различаться из-за наследования. + DataObject masterFromActualCache = dataObjectCacheActual.GetLivingDataObject(currentMaster.GetType(), currentMaster.__PrimaryKey); + + if (masterFromActualCache == null) + { // Если мастера ранее не было в кэше, то просто его туда переносим. + dataObjectCacheActual.AddDataObject(currentMaster); + + // Но в добавленном мастере могут быть мастера 2 и далее уровней. + ProperCacheUpdateForOneObject(dataObjectCacheActual, dataObjectCacheWithMasters, currentMaster, true); + } + else + { // Если мастер был в кэше, то аккуратно нужно перенести только незагруженные ранее свойства. + if (masterFromActualCache.GetStatus(false) == ObjectStatus.UnAltered && masterFromActualCache.GetLoadingState() != LoadingState.Loaded) + { + ProperUpdateOfObject(masterFromActualCache, currentMaster, dataObjectCacheActual, dataObjectCacheWithMasters); + } + } + } + } + } + } + } } From cf9a4b4ee68f7e593f9ababf32c85811c20480b6 Mon Sep 17 00:00:00 2001 From: tosotova Date: Wed, 14 Feb 2024 09:55:32 +0500 Subject: [PATCH 4/6] Updated Flexberry ODataService up to 7.2.0-beta01 --- CHANGELOG.md | 4 ++-- NewPlatform.Flexberry.ORM.ODataService.nuspec | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 850d3165..cd386d32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,11 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed ### Fixed +1. Fixed loading of object with crushing of already loaded masters. +2. Fixed loading of details. ## [7.1.1] - 2023.06.08 -### Added - ### Changed 1. Updated `NewPlatform.Flexberry.ORM` up to `7.1.1`. 2. Get properties from objects for send it to frontend always rethrow exception now. diff --git a/NewPlatform.Flexberry.ORM.ODataService.nuspec b/NewPlatform.Flexberry.ORM.ODataService.nuspec index 7f32de62..f8b448ee 100644 --- a/NewPlatform.Flexberry.ORM.ODataService.nuspec +++ b/NewPlatform.Flexberry.ORM.ODataService.nuspec @@ -2,7 +2,7 @@ NewPlatform.Flexberry.ORM.ODataService - 7.1.1 + 7.2.0-beta01 Flexberry ORM ODataService New Platform Ltd. New Platform Ltd. @@ -12,14 +12,9 @@ true Flexberry ORM OData Service Package. - Changed - 1. Updated `NewPlatform.Flexberry.ORM` up to `7.1.1`. - 2. Get properties from objects for send it to frontend always rethrow exception now. - Fixed - 1. Fixed problem with metadata when inheritance and PublishName is used. - 2. Safe load details with complex type usage hierarchy. - + 1. Fixed loading of object with crushing of already loaded masters. + 2. Fixed loading of details. Copyright New Platform Ltd 2023 Flexberry ORM OData ODataService From bf5481949ededaf15c2460e91405d854b8eda0e0 Mon Sep 17 00:00:00 2001 From: tosotova Date: Wed, 14 Feb 2024 10:57:16 +0500 Subject: [PATCH 5/6] Fixed batch test for .net4.5 --- .../CRUD/BatchTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs index 2b57a3c7..629b7f8d 100644 --- a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs +++ b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs @@ -236,7 +236,7 @@ public void UpdateWithInheritanceAndDetailsTest() using (HttpResponseMessage response = args.HttpClient.SendAsync(batchRequest).Result) { // Assert. - CheckODataBatchResponseStatusCode(response, new HttpStatusCode[] { HttpStatusCode.OK, HttpStatusCode.OK }); + CheckODataBatchResponseStatusCode(response, new HttpStatusCode[] { HttpStatusCode.OK, HttpStatusCode.Created, HttpStatusCode.OK }); string[] thirdPropertiesNames2 = { From 3b3f3663a88c51d74f8aca7476e846f1c2cf19db Mon Sep 17 00:00:00 2001 From: tosotova Date: Wed, 14 Feb 2024 14:11:48 +0500 Subject: [PATCH 6/6] Changes by CR --- .../Extensions/DataServiceExtensions.cs | 3 ++- .../CRUD/BatchTest.cs | 16 +++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs b/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs index 9b29e2e3..e0245aa6 100644 --- a/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs +++ b/NewPlatform.Flexberry.ORM.ODataService/Extensions/DataServiceExtensions.cs @@ -365,7 +365,8 @@ private static void ProperCacheUpdateForOneObject(DataObjectCache dataObjectCach DataObject masterFromActualCache = dataObjectCacheActual.GetLivingDataObject(currentMaster.GetType(), currentMaster.__PrimaryKey); if (masterFromActualCache == null) - { // Если мастера ранее не было в кэше, то просто его туда переносим. + { + // Если мастера ранее не было в кэше, то просто его туда переносим. dataObjectCacheActual.AddDataObject(currentMaster); // Но в добавленном мастере могут быть мастера 2 и далее уровней. diff --git a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs index 629b7f8d..c0de8995 100644 --- a/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs +++ b/Tests/NewPlatform.Flexberry.ORM.ODataService.Tests/CRUD/BatchTest.cs @@ -35,14 +35,12 @@ public BatchTest(CustomWebApplicationFactory /// Test batch update of master-class with class at the same time. /// It checks that dataobject cache is not crashed. + /// There are a master and object with link to master at batch request. Master is the first at the batch request. The link between object and master is not changed. + /// It is necessary that during batch processing master stay the same and is not overwriten. /// [Fact] public void UpdateMasterAndClassTest() { - /* Суть теста в том, что сначала в батч-запрос идёт мастер, а далее идёт сам объект со ссылкой на мастера. - * Ссылка на мастера не меняется при этом. - * Необходимо, чтобы при последовательной обработке батчей мастер не был перевычитан и его значение обновилось корректно. - */ ActODataService(args => { // Arrange. @@ -118,17 +116,13 @@ public void UpdateMasterAndClassTest() /// /// Test batch update with inheritance. /// It checks that dataobject cache is not crashed. + /// There are classes A, its detail B, that has descendant C. During class A loading its details are loaded too, but details are loaded by View of class B, while details are of class C. + /// Thus there are objects of type C at the cache while they are loaded by properties of class B only. That's why the state of details is LightLoaded. + /// It is necessary to post-load only propertues that are not loaded before (loaded properties can be changed). /// [Fact] public void UpdateWithInheritanceAndDetailsTest() { - /* Суть теста в том, что есть класс А, у него детейл Б, у которого есть наследник В. - * При загрузке объекта класса А подгрузятся его детейлы, однако они будут подгружены по представлению, которое соответствует классу Б, даже если детейлы класса В. - * Таким образом, в кэше окажутся объекты класса В, которые загружены только по свойствам Б. Раз не все свойства подгружены, то состояние LightLoaded. - * Догружать необходимо только те свойства, что ещё не загружались (потому что загруженные уже могут быть изменены). - * - * Необходимо, чтобы при последовательной обработке батча все значения обновились корректно. - */ ActODataService(args => { // Arrange.