Procházet zdrojové kódy

db schema model v.1.0.10

update Data
Dalibor Votruba před 4 roky
rodič
revize
9c128cfc24

+ 9 - 3
@Database/bo_create_schema.sql

@@ -1,4 +1,4 @@
--- 19.10.2021 1.0.9
+-- 19.10.2021 1.0.10
 -- Table User --------------------------
 --Defines User identity with statistics informations. Defines if user is enabled and/or user is system account also.
 CREATE TABLE [dbo].[User]
@@ -269,6 +269,7 @@ CREATE TABLE [dbo].[Metadocument]
 (
     [Id] [bigint] NOT NULL IDENTITY (1, 1),
     [StructureId] [bigint] NOT NULL,
+    [AffinityRegistrationId] [bigint] NULL,
     [Name] [nvarchar] (200) NOT NULL,
     [Status] [int] NOT NULL CONSTRAINT DF_Metadocument_Status DEFAULT 0,
     [Created] [datetime] NOT NULL CONSTRAINT DF_Metadocument_Created DEFAULT getdate(),
@@ -287,6 +288,9 @@ GO
 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Reference to owning structure (workspace)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Metadocument', @level2type=N'COLUMN',@level2name=N'StructureId'
 GO
 
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Reference to assigned ProcessServer process which currently working on document.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Metadocument', @level2type=N'COLUMN',@level2name=N'AffinityRegistrationId'
+GO
+
 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Metadocument name' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Metadocument', @level2type=N'COLUMN',@level2name=N'Name'
 GO
 
@@ -1156,7 +1160,8 @@ ADD
     CONSTRAINT REL_Metadocument_Structure FOREIGN KEY (StructureId) REFERENCES [dbo].[Structure] (Id), 
     CONSTRAINT REL_Metadocument_User_Created FOREIGN KEY (CreatedByUserId) REFERENCES [dbo].[User] (Id), 
     CONSTRAINT REL_Metadocument_User_Modified FOREIGN KEY (ModifiedByUserId) REFERENCES [dbo].[User] (Id), 
-    CONSTRAINT REL_Metadocument_User_Downloaded FOREIGN KEY (LastDownloadedByUserId) REFERENCES [dbo].[User] (Id)
+    CONSTRAINT REL_Metadocument_User_Downloaded FOREIGN KEY (LastDownloadedByUserId) REFERENCES [dbo].[User] (Id), 
+    CONSTRAINT REL_Metadocument_Registration FOREIGN KEY (AffinityRegistrationId) REFERENCES [dbo].[Registration] (Id)
 GO
 
 -- References for StatusHistory --------------------------
@@ -1242,5 +1247,6 @@ ADD
     CONSTRAINT REL_InvoiceIssuer_User_Modified FOREIGN KEY (ModifiedByUserId) REFERENCES [dbo].[User] (Id)
 GO
 
-EXEC sys.sp_updateextendedproperty @name=N'BO_Version', @value=N'1.0.9'
+
+EXEC sys.sp_updateextendedproperty @name=N'BO_Version', @value=N'1.0.10'
 GO

+ 98 - 37
@Documentation/BlueprintOptimizer.simp

@@ -147,7 +147,7 @@
     <entity-ids>
       <counter>
         <item-type type-id="group" type="Group" />
-        <value>4100</value>
+        <value>4165</value>
       </counter>
       <counter>
         <item-type type-id="erd-entity" type="Entity" />
@@ -203,7 +203,7 @@
       </counter>
       <counter>
         <item-type type-id="erd-relationship" type="Relationship" />
-        <value>66</value>
+        <value>71</value>
       </counter>
       <counter>
         <item-type type-id="ui-area" type="Area" />
@@ -367,7 +367,7 @@
     <fields>
       <counter>
         <type>SoftwareIdeasModeler.Core.DiagramItems.Erd.ErdEntityAttribute</type>
-        <value>246</value>
+        <value>247</value>
       </counter>
       <counter>
         <type>SoftwareIdeasModeler.Core.DiagramItems.Erd.ErdEntityIndex</type>
@@ -614,6 +614,34 @@
       <comment>IsGold means that workspace has PresetCustomBillingPlan</comment>
     </item>
     <item id="di7097db1372c949a8a2c0ed56df76831f6863" cid="CN030" type="comment-connector" name="" style-class="" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 13:15:50" from="5b1add093daa4ce586ea80244612469e" to="13a6b5d699e34724b34d2f0e3cf411f6" />
+    <item id="f185cb5e16734063ba389ea51c994658" cid="REL066" type="erd-relationship" name="" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="12/21/2021 14:33:33" from="f19722e950a347d9946336728e7a9b9c" to="3a5d239825ed496b9e4a88608b4d49ba">
+      <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="0..1">
+        <attribute-pairs>
+          <attribute-pair from-attribute="af273ee4cac4e46968e10087654ea956e134" to-attribute="a1767a774d3ed49f7bf7f6b697d958d9c422" />
+        </attribute-pairs>
+      </erd-relation>
+    </item>
+    <item id="41a1afdd23aa41689c5ca796e4020211" cid="REL067" type="erd-relationship" name="" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="12/21/2021 14:34:00" from="f19722e950a347d9946336728e7a9b9c" to="3a5d239825ed496b9e4a88608b4d49ba">
+      <erd-relation type="Identifying" multiplicity-from="" multiplicity-to="">
+        <attribute-pairs>
+          <attribute-pair from-attribute="af273ee4cac4e46968e10087654ea956e134" to-attribute="a1767a774d3ed49f7bf7f6b697d958d9c422" />
+        </attribute-pairs>
+      </erd-relation>
+    </item>
+    <item id="20d7d990552240abb476fa07eeb3f22f" cid="REL068" type="erd-relationship" name="REL_Metadocument_Registration" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="12/21/2021 14:34:31" from="3a5d239825ed496b9e4a88608b4d49ba" to="f19722e950a347d9946336728e7a9b9c">
+      <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="0..1">
+        <attribute-pairs>
+          <attribute-pair from-attribute="a1767a774d3ed49f7bf7f6b697d958d9c422" to-attribute="af273ee4cac4e46968e10087654ea956e134" />
+        </attribute-pairs>
+      </erd-relation>
+    </item>
+    <item id="ffc60c26f5bb42ab8c5b73fe7e3bc94b" cid="REL069" type="erd-relationship" name="" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="12/21/2021 14:37:43" from="3a5d239825ed496b9e4a88608b4d49ba" to="f19722e950a347d9946336728e7a9b9c">
+      <erd-relation type="Identifying" multiplicity-from="1" multiplicity-to="0..1">
+        <attribute-pairs>
+          <attribute-pair from-attribute="a1767a774d3ed49f7bf7f6b697d958d9c422" to-attribute="af273ee4cac4e46968e10087654ea956e134" />
+        </attribute-pairs>
+      </erd-relation>
+    </item>
   </items>
   <models>
     <model id="p57fd86bed30d49b2a5908f75c57a5e76_108725137" name="Database" namespace="" order-index="1" expanded="true">
@@ -724,7 +752,7 @@
           </documentation>
           <abstract-items />
           <sub-models />
-          <diagram type="entity-relationship" id="pca974f586cd54eb2957d89ec61c4843d_762498462" name="BOServer" order-index="0" uid="" show-id="false" show-name="true" show-parent-name="false" name-style="local-auto-parents" show-stereotypes="true" show-tagged-values="false" show-template-parameters="true" show-fields="true" show-field-tags="true" show-empty-compartments="true" show-special-indicators="false" show-rules="true" show-attributes="true" show-attribute-visibility="true" show-operations="true" show-operation-parameters="true" show-operation-visibility="true" show-visibility-sign="true" show-nullability="true" show-sequence-number="false" show-extension-points="false" show-relationship-texts="true" show-data="true" show-description="false" show-field-description="false" auto-routed-paths="false" default-line-style="default" default-type-set="MSSQL" view-location="1728,762">
+          <diagram type="entity-relationship" id="pca974f586cd54eb2957d89ec61c4843d_762498462" name="BOServer" order-index="0" uid="" show-id="false" show-name="true" show-parent-name="false" name-style="local-auto-parents" show-stereotypes="true" show-tagged-values="false" show-template-parameters="true" show-fields="true" show-field-tags="true" show-empty-compartments="true" show-special-indicators="false" show-rules="true" show-attributes="true" show-attribute-visibility="true" show-operations="true" show-operation-parameters="true" show-operation-visibility="true" show-visibility-sign="true" show-nullability="true" show-sequence-number="false" show-extension-points="false" show-relationship-texts="true" show-data="true" show-description="false" show-field-description="false" auto-routed-paths="false" default-line-style="default" default-type-set="MSSQL" view-location="445,-258">
             <style>
               <background-color index="1" color="#FFFFFFFF" />
               <background-color index="2" color="#FFFFFFFF" />
@@ -736,9 +764,9 @@
               </authors>
               <description>AppServer database model</description>
               <creation-date>07/26/2021 15:41:20</creation-date>
-              <change-date>08/17/2021 09:26:32</change-date>
+              <change-date>12/21/2021 14:38:05</change-date>
               <revision-count>0</revision-count>
-              <version>1.0.9.</version>
+              <version>1.0.10.</version>
             </meta>
             <documentation>
               <text>
@@ -1535,6 +1563,7 @@
                 <attributes>
                   <attribute uid="a7b64ac4b5cba4a7e9b2cb89ee667f597861" cid="ELEM035" name="Id" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="false" primary-key="true" nullable="false" description="Primary key of metadocument record" default-value="" auto-increment="true" creation-date="07/27/2021 07:12:40" />
                   <attribute uid="a1f51f395d6344cc4a44d1de584a84ee0454" cid="ELEM043" name="StructureId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="false" description="Reference to owning structure (workspace)" default-value="" auto-increment="false" creation-date="07/27/2021 07:13:18" />
+                  <attribute uid="af273ee4cac4e46968e10087654ea956e134" cid="EA246" name="AffinityRegistrationId" type="bigint" type-id="MsSql.bigint" type-size="" foreign-key="true" primary-key="false" nullable="true" description="Reference to assigned ProcessServer process which currently working on document." default-value="" auto-increment="false" creation-date="12/21/2021 14:31:48" />
                   <attribute uid="a03021f927afd46c188f82453bfa62acf934" cid="ELEM044" name="Name" type="nvarchar" type-id="MsSql.nvarchar" type-size="200" foreign-key="false" primary-key="false" nullable="false" description="Metadocument name" default-value="" auto-increment="false" creation-date="07/27/2021 07:14:12" />
                   <attribute uid="a5d2e6bc47b834f189d267ec4f6465349709" cid="ELEM045" name="Status" type="int" type-id="MsSql.int" type-size="" foreign-key="false" primary-key="false" nullable="false" description="Metadocument status" default-value="0" auto-increment="false" creation-date="07/27/2021 07:17:39" />
                   <attribute uid="a8011f93790eb4392a5e8f2a10aa58fcc862" cid="ELEM037" name="Created" type="datetime" type-id="MsSql.datetime" type-size="" foreign-key="false" primary-key="false" nullable="false" description="Timestamp when metadocument was created (uploaded)" default-value="getdate()" auto-increment="false" creation-date="07/27/2021 07:12:40" />
@@ -2898,6 +2927,19 @@
                   </attribute-pairs>
                 </erd-relation>
               </item>
+              <item id="42f0a2f9fa4f4357aade2b5b1da1f821" cid="REL070" type="erd-relationship" name="REL_Metadocument_Registration" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="12/21/2021 14:38:05" from="f19722e950a347d9946336728e7a9b9c" to="3a5d239825ed496b9e4a88608b4d49ba">
+                <stereotypes>
+                  <stereotype name="relation" />
+                </stereotypes>
+                <stereotype-instances>
+                  <stereotype id="42f0a2f9fa4f4357aade2b5b1da1f821_relation_c" type="relation" ref="" />
+                </stereotype-instances>
+                <erd-relation type="Identifying" multiplicity-from="0..1" multiplicity-to="1">
+                  <attribute-pairs>
+                    <attribute-pair from-attribute="af273ee4cac4e46968e10087654ea956e134" to-attribute="a1767a774d3ed49f7bf7f6b697d958d9c422" />
+                  </attribute-pairs>
+                </erd-relation>
+              </item>
             </abstract-items>
             <layer id="6fa09190adbe4d97861d913962fcbf64" name="Default" visible="true" enabled="true" locked="false">
               <item id="ef322c9446f34d3db88bcf4cbdcbbbda" iid="68002f8afdb045bea4ad4abf68c5d193" creation-date="07/26/2021 15:46:45" order-index="0" type="entity">
@@ -3013,7 +3055,7 @@
                 <relation from="80e14dbf9d8f4a9f9e52efcb92fe8e97" from-iid="227931401c474ce3953e7ec02287e8a4" from-field="af143d15824124110b676deab330b5bfd973" to="80e14dbf9d8f4a9f9e52efcb92fe8e97" to-iid="227931401c474ce3953e7ec02287e8a4" to-field="ad209340532f94e32b4cf1917e5a20cd6364" />
               </item>
               <item id="f19722e950a347d9946336728e7a9b9c" iid="779a4cd4f1d1476ea87da5d9a66f8c12" creation-date="07/27/2021 07:05:30" order-index="15" type="entity">
-                <layout ax="2600" ay="1638" awidth="381" aheight="320" x="2600" y="1638" width="381" height="320" rotation-center="-120.5,-80" />
+                <layout ax="2600" ay="1633" awidth="381" aheight="325" x="2600" y="1633" width="381" height="325" rotation-center="-120.5,-77.5" />
                 <erd-entity show-nullability="true" show-description="true" />
               </item>
               <item id="508e601ed32f4ca29e4b5289575ba795" iid="dbcd2881d0eb490e8f664d543a32091c" creation-date="07/27/2021 07:18:10" order-index="16" type="entity">
@@ -3047,46 +3089,46 @@
                 <relation from="b67864ae142447b087be3d82e8f18e70" from-iid="4f2ffee5135f42ba8190dd0911d849e9" from-field="a2da35409cd704d75b9a8472accca9a93740" to="ef322c9446f34d3db88bcf4cbdcbbbda" to-iid="68002f8afdb045bea4ad4abf68c5d193" to-field="a807a3f93ff154a9bbd2f13a3b9971b2c353" />
               </item>
               <item id="c0ce9ad877694d26bc57b50f21db5a58" iid="9362b9135d9a4f22a87420b2a82ae008" creation-date="07/27/2021 07:56:09" order-index="21" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-start-point="true" lock-to-fields="true" auto-path="" x1="2600" y1="1760" x2="2600" y2="640" start-border-pos="0.905078125" end-border-pos="0.91542904290429" start-local-pos="122" end-local-pos="103" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-start-point="true" lock-to-fields="true" auto-path="" x1="2600" y1="1754" x2="2600" y2="640" start-border-pos="0.906538461538462" end-border-pos="0.91542904290429" start-local-pos="121" end-local-pos="103" name-position="0,20">
                   <points>
-                    <point x="2600" y="1760" />
+                    <point x="2600" y="1754" />
                     <point x="2600" y="640" />
                   </points>
                 </layout>
                 <relation from="f19722e950a347d9946336728e7a9b9c" from-iid="779a4cd4f1d1476ea87da5d9a66f8c12" from-field="a1f51f395d6344cc4a44d1de584a84ee0454" to="80e14dbf9d8f4a9f9e52efcb92fe8e97" to-iid="227931401c474ce3953e7ec02287e8a4" to-field="af143d15824124110b676deab330b5bfd973" />
               </item>
               <item id="51a32d625c574fdcb3a4d01803f57cea" iid="54e09d9a34a641ec948a97bdbb3e9054" creation-date="07/27/2021 07:57:05" order-index="22" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="2600" y1="1874" x2="2164" y2="1262" start-border-pos="0.816015625" end-border-pos="0.313239644970414" start-local-pos="236" end-local-pos="86" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="2600" y1="1888" x2="2164" y2="1262" start-border-pos="0.804230769230769" end-border-pos="0.313239644970414" start-local-pos="235" end-local-pos="86" name-position="0,20">
                   <points>
-                    <point x="2600" y="1874" />
+                    <point x="2600" y="1888" />
                     <point x="2164" y="1262" />
                   </points>
                 </layout>
                 <relation from="f19722e950a347d9946336728e7a9b9c" from-iid="779a4cd4f1d1476ea87da5d9a66f8c12" from-field="a2618fb81e27a4e63b381d4bffca2fdfe862" to="ef322c9446f34d3db88bcf4cbdcbbbda" to-iid="68002f8afdb045bea4ad4abf68c5d193" to-field="a807a3f93ff154a9bbd2f13a3b9971b2c353" />
               </item>
               <item id="3201398364364830a132932fd99e7394" iid="9be38ab764134998aeeac0f1cab70637" creation-date="07/27/2021 07:57:46" order-index="23" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-start-point="true" lock-to-fields="true" auto-path="" x1="2600" y1="1892" x2="2164" y2="1262" start-border-pos="0.801171875" end-border-pos="0.313239644970414" start-local-pos="254" end-local-pos="86" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-start-point="true" lock-to-fields="true" auto-path="" x1="2600" y1="1906" x2="2164" y2="1262" start-border-pos="0.789615384615385" end-border-pos="0.313239644970414" start-local-pos="255" end-local-pos="86" name-position="0,20">
                   <points>
-                    <point x="2600" y="1892" />
+                    <point x="2600" y="1906" />
                     <point x="2164" y="1262" />
                   </points>
                 </layout>
                 <relation from="f19722e950a347d9946336728e7a9b9c" from-iid="779a4cd4f1d1476ea87da5d9a66f8c12" from-field="ae0f42fa3a0a64040b5c052f8aa77802f862" to="ef322c9446f34d3db88bcf4cbdcbbbda" to-iid="68002f8afdb045bea4ad4abf68c5d193" to-field="a807a3f93ff154a9bbd2f13a3b9971b2c353" />
               </item>
               <item id="84566c0ddc1c4285b8a7b7c00283733d" iid="5cba0dae595747c2a6ff8e4eec92bf42" creation-date="07/27/2021 07:58:16" order-index="24" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-start-point="true" lock-to-fields="true" auto-path="" x1="2600" y1="1912" x2="2164" y2="1262" start-border-pos="0.786328125" end-border-pos="0.313239644970414" start-local-pos="274" end-local-pos="86" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-start-point="true" lock-to-fields="true" auto-path="" x1="2600" y1="1926" x2="2164" y2="1262" start-border-pos="0.775" end-border-pos="0.313239644970414" start-local-pos="273" end-local-pos="86" name-position="0,20">
                   <points>
-                    <point x="2600" y="1912" />
+                    <point x="2600" y="1926" />
                     <point x="2164" y="1262" />
                   </points>
                 </layout>
                 <relation from="f19722e950a347d9946336728e7a9b9c" from-iid="779a4cd4f1d1476ea87da5d9a66f8c12" from-field="aaf62aac4ebed4babb6d55a02d89a1a05862" to="ef322c9446f34d3db88bcf4cbdcbbbda" to-iid="68002f8afdb045bea4ad4abf68c5d193" to-field="a807a3f93ff154a9bbd2f13a3b9971b2c353" />
               </item>
               <item id="2d73b15dbbd448018ff60fcde9ea98a9" iid="224942db504945f7ae0e8b0559ff84dd" creation-date="07/27/2021 08:00:15" order-index="25" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="2296" y1="1986" x2="2600" y2="1740" start-border-pos="0.352966101694915" end-border-pos="0.919921875" start-local-pos="121" end-local-pos="102" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="2296" y1="1986" x2="2600" y2="1736" start-border-pos="0.352966101694915" end-border-pos="0.921153846153846" start-local-pos="121" end-local-pos="103" name-position="0,20">
                   <points>
                     <point x="2296" y="1986" />
-                    <point x="2600" y="1740" />
+                    <point x="2600" y="1736" />
                   </points>
                 </layout>
                 <relation from="66aaf293e08545e697730b154b412ac2" from-iid="792bc5686e0e434bb3a945fbb24901e8" from-field="afbf1bfe4382a419a97afc0b6365ccc3f595" to="f19722e950a347d9946336728e7a9b9c" to-iid="779a4cd4f1d1476ea87da5d9a66f8c12" to-field="a7b64ac4b5cba4a7e9b2cb89ee667f597861" />
@@ -3119,10 +3161,10 @@
                 <relation from="508e601ed32f4ca29e4b5289575ba795" from-iid="dbcd2881d0eb490e8f664d543a32091c" from-field="a3f10c23945c6454f8ea4cd5572de2077374" to="ef322c9446f34d3db88bcf4cbdcbbbda" to-iid="68002f8afdb045bea4ad4abf68c5d193" to-field="a807a3f93ff154a9bbd2f13a3b9971b2c353" />
               </item>
               <item id="7838665b6ec7474ea14f53946f2181ff" iid="fec87ab4264e4ae7a435e35126a26e19" creation-date="07/27/2021 08:02:58" order-index="29" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="2839" y1="1412" x2="2981" y2="1740" start-border-pos="0.86735807860262" end-border-pos="0.330078125" start-local-pos="122" end-local-pos="102" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="2839" y1="1412" x2="2981" y2="1736" start-border-pos="0.86735807860262" end-border-pos="0.328846153846154" start-local-pos="122" end-local-pos="103" name-position="0,20">
                   <points>
                     <point x="2839" y="1412" />
-                    <point x="2981" y="1740" />
+                    <point x="2981" y="1736" />
                   </points>
                 </layout>
                 <relation from="508e601ed32f4ca29e4b5289575ba795" from-iid="dbcd2881d0eb490e8f664d543a32091c" from-field="af15e8a4f21fb4834b6479b09c3cfd211374" to="f19722e950a347d9946336728e7a9b9c" to-iid="779a4cd4f1d1476ea87da5d9a66f8c12" to-field="a7b64ac4b5cba4a7e9b2cb89ee667f597861" />
@@ -3145,10 +3187,10 @@
                 <erd-entity show-nullability="true" show-description="true" />
               </item>
               <item id="c3f22d02ade24ffd981ca1a609f73825" iid="d4b130aacdf4473d8d6f1ae9b35cda0d" creation-date="07/27/2021 08:10:25" order-index="33" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="1272" y1="1158" x2="2600" y2="1740" start-border-pos="0.382763975155279" end-border-pos="0.919921875" start-local-pos="85" end-local-pos="102" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="1272" y1="1158" x2="2600" y2="1736" start-border-pos="0.382763975155279" end-border-pos="0.921153846153846" start-local-pos="85" end-local-pos="103" name-position="0,20">
                   <points>
                     <point x="1272" y="1158" />
-                    <point x="2600" y="1740" />
+                    <point x="2600" y="1736" />
                   </points>
                 </layout>
                 <relation from="41c493b34a4740ed82e16919f89fbba3" from-iid="ea106ef76fdd45f5839feffbac78ee3f" from-field="a9f40b3045d534715bc75f93b5de3cd74905" to="f19722e950a347d9946336728e7a9b9c" to-iid="779a4cd4f1d1476ea87da5d9a66f8c12" to-field="a7b64ac4b5cba4a7e9b2cb89ee667f597861" />
@@ -3220,10 +3262,10 @@
                 <relation from="e80985e7fce14193b34889876668ff81" from-iid="aed881e5e9074359a10bd1cac19d9d0e" from-field="a909885cbfed747b798799b779e7fcfab446" to="24a5c2e6d7df4dd380da583904b6e81c" to-iid="79f5dcb934c842a1bddc246988b2b33b" to-field="a7dde6800c37940389459c8caf8b01322535" />
               </item>
               <item id="01ce4003e9ff46e890652dffa23fe01b" iid="6a21714cd4d74d6a8a44368ec3ef7a96" creation-date="07/27/2021 08:36:33" order-index="44" type="relation">
-                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="1744" y1="1636" x2="2600" y2="1740" start-border-pos="0.325062814070352" end-border-pos="0.919921875" start-local-pos="119" end-local-pos="102" name-position="0,20">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="straight" lock-to-fields="true" auto-path="" x1="1744" y1="1636" x2="2600" y2="1736" start-border-pos="0.325062814070352" end-border-pos="0.921153846153846" start-local-pos="119" end-local-pos="103" name-position="0,20">
                   <points>
                     <point x="1744" y="1636" />
-                    <point x="2600" y="1740" />
+                    <point x="2600" y="1736" />
                   </points>
                 </layout>
                 <relation from="4629c8efe5764821a4f2ffb806413d2d" from-iid="a8224407a4be49b9a96cdea96c056054" from-field="a11608f1f311d4da09f10c0070b88b5f2306" to="f19722e950a347d9946336728e7a9b9c" to-iid="779a4cd4f1d1476ea87da5d9a66f8c12" to-field="a7b64ac4b5cba4a7e9b2cb89ee667f597861" />
@@ -3356,9 +3398,18 @@
                 <relation from="4629c8efe5764821a4f2ffb806413d2d" from-iid="a8224407a4be49b9a96cdea96c056054" to="e80985e7fce14193b34889876668ff81" to-iid="aed881e5e9074359a10bd1cac19d9d0e" to-field="a1037ef123e2f4e5bba8993964bafcb81218" />
               </item>
               <item id="3a5d239825ed496b9e4a88608b4d49ba" iid="f83b50caf747406bac8a3fd15e53d170" creation-date="08/17/2021 09:26:32" order-index="64" type="entity">
-                <layout ax="713" ay="-320" awidth="264" aheight="247" x="713" y="-320" width="264" height="247" rotation-center="0,107.5" />
+                <layout ax="3369" ay="1768" awidth="264" aheight="247" x="3369" y="1768" width="264" height="247" rotation-center="0,107.5" />
                 <erd-entity show-nullability="true" show-description="true" />
               </item>
+              <item id="42f0a2f9fa4f4357aade2b5b1da1f821" iid="1bf79993c0b3444c9d3ec04a5998841c" creation-date="12/21/2021 14:38:05" order-index="65" type="relation">
+                <layout start-role-position="25,15" end-role-position="25,-15" line-style="oblique" lock-to-fields="true" auto-path="" x1="2981" y1="1774" x2="3369" y2="1854" start-border-pos="0.358076923076923" end-border-pos="0.913461538461538" start-local-pos="141" end-local-pos="86" name-position="0,20">
+                  <points>
+                    <point x="2981" y="1774" />
+                    <point x="3369" y="1854" />
+                  </points>
+                </layout>
+                <relation from="f19722e950a347d9946336728e7a9b9c" from-iid="779a4cd4f1d1476ea87da5d9a66f8c12" from-field="af273ee4cac4e46968e10087654ea956e134" to="3a5d239825ed496b9e4a88608b4d49ba" to-iid="f83b50caf747406bac8a3fd15e53d170" to-field="a1767a774d3ed49f7bf7f6b697d958d9c422" />
+              </item>
             </layer>
           </diagram>
         </model>
@@ -3440,7 +3491,7 @@
       </meta>
       <abstract-items />
       <sub-models>
-        <model id="p235a72e88448453dae59194758ba09e0_767848966" name="AppServer" namespace="" order-index="2" expanded="true">
+        <model id="p235a72e88448453dae59194758ba09e0_767848966" name="AppServer" namespace="" order-index="2">
           <meta>
             <authors>
               <author />
@@ -5240,8 +5291,8 @@
                   </item>
                   <item id="1085a5f86a0944c0ad687f6e06cffb50" cid="REL015" type="relationship" name="" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 12:12:09" from="dc62b4a6eddb4ffea9922a1210e1965a" to="13a6b5d699e34724b34d2f0e3cf411f6" visibility="package">
                     <relation from="dc62b4a6eddb4ffea9922a1210e1965a" to="13a6b5d699e34724b34d2f0e3cf411f6" derived="false">
-                      <start-role id="umlar-5869c95d-168e-44c9-99ee-b136d4f2fc7d" name="" multiplicity="1" navigability="yes" association-type="association" visibility="public" />
-                      <end-role id="umlar-81d74a88-6444-428b-a24e-c0cc73611bd1" name="" multiplicity="1" navigability="yes" association-type="association" visibility="private" />
+                      <start-role id="umlar-65dd3f97-7292-40e1-952f-4c457ed3106f" name="" multiplicity="1" navigability="yes" association-type="association" visibility="public" />
+                      <end-role id="umlar-71b3f347-d2f6-4b69-8dc6-b656828e976b" name="" multiplicity="1" navigability="yes" association-type="association" visibility="private" />
                     </relation>
                   </item>
                   <item id="d197a10d487f4feca76eaaa52539564d" cid="C015" type="class" name="Metadocument" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 12:13:29" visibility="undefined">
@@ -5268,6 +5319,8 @@
                       <owned-item ref="4ec933cf2fc84617a9a8494196004a90" />
                       <owned-item ref="4ec933cf2fc84617a9a8494196004a90" />
                       <owned-item ref="4ec933cf2fc84617a9a8494196004a90" />
+                      <owned-item ref="4ec933cf2fc84617a9a8494196004a90" />
+                      <owned-item ref="4ec933cf2fc84617a9a8494196004a90" />
                     </owned-items>
                     <attributes>
                       <attribute id="a41e119653aca4d98832721d5cffe17c3247" cid="PROP008" name="Created" creation-date="07/30/2021 13:08:53" property-ref="4ec933cf2fc84617a9a8494196004a90" />
@@ -5375,6 +5428,10 @@
                       <owned-item ref="5ed1b0ad3800445a852c688e71a6c3de" />
                       <owned-item ref="f329c375b119435e8347637cc1bace4f" />
                       <owned-item ref="5ed1b0ad3800445a852c688e71a6c3de" />
+                      <owned-item ref="f329c375b119435e8347637cc1bace4f" />
+                      <owned-item ref="5ed1b0ad3800445a852c688e71a6c3de" />
+                      <owned-item ref="f329c375b119435e8347637cc1bace4f" />
+                      <owned-item ref="5ed1b0ad3800445a852c688e71a6c3de" />
                     </owned-items>
                     <attributes>
                       <attribute id="ac3f9a2f9163c4d189a8531933c4505ab534" cid="PROP003" name="BillingPlanCopy" creation-date="07/30/2021 13:03:05" property-ref="f329c375b119435e8347637cc1bace4f" />
@@ -5412,8 +5469,8 @@
                   </item>
                   <item id="45a4d933848d4de3b8cfb3de6264f86a" cid="REL023" type="relationship" name="Status" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 12:28:30" from="d9b508c513144e22a67092ae79418750" to="d197a10d487f4feca76eaaa52539564d" visibility="package">
                     <relation from="d9b508c513144e22a67092ae79418750" to="d197a10d487f4feca76eaaa52539564d" derived="false">
-                      <start-role id="umlar-77a5cae8-b8f8-4f3c-94d7-280da80a4fe0" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
-                      <end-role id="umlar-86a30704-1267-4c93-bcde-ca3d25818468" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <start-role id="umlar-ff751da2-6309-48d9-8ac7-bbf976f5d1fd" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <end-role id="umlar-4b922bc8-3144-4762-9a94-446646c53899" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
                     </relation>
                   </item>
                   <item id="270ad5efb5d64112afacbeca5ffeca86" cid="C019" type="class" name="BillingPlan" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 12:32:46" visibility="undefined">
@@ -5455,6 +5512,10 @@
                       <owned-item ref="2a23d5a19cd848a8b3a41e2d3f2ee886" />
                       <owned-item ref="2950a0ddb8b0416da9ccee2fbe9bf227" />
                       <owned-item ref="2a23d5a19cd848a8b3a41e2d3f2ee886" />
+                      <owned-item ref="2950a0ddb8b0416da9ccee2fbe9bf227" />
+                      <owned-item ref="2a23d5a19cd848a8b3a41e2d3f2ee886" />
+                      <owned-item ref="2950a0ddb8b0416da9ccee2fbe9bf227" />
+                      <owned-item ref="2a23d5a19cd848a8b3a41e2d3f2ee886" />
                     </owned-items>
                     <attributes>
                       <attribute id="a9e9ff08df85849a28cc714ae4ca92c24350" cid="PROP005" name="Presets" creation-date="07/30/2021 13:05:16" property-ref="2950a0ddb8b0416da9ccee2fbe9bf227" />
@@ -5473,8 +5534,8 @@
                       <stereotype id="ca3eacde14404b8a939edc0ba600df9b_state_c" type="state" ref="" />
                     </stereotype-instances>
                     <relation from="13a6b5d699e34724b34d2f0e3cf411f6" to="270ad5efb5d64112afacbeca5ffeca86" derived="false">
-                      <start-role id="umlar-4ea94026-b9e9-4885-9f69-e67f49e466c7" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
-                      <end-role id="umlar-6bf86e56-8f5c-4f18-8d0a-988efc9ab111" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <start-role id="umlar-8942476e-b090-4078-8cf4-c51c8226809e" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <end-role id="umlar-8f3a58b8-8831-4090-9794-4fcde1721fa1" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
                     </relation>
                   </item>
                   <item id="39db4851d2f34131ba16e6788ed23770" cid="REL037" type="relationship" name="Consumtion" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 12:35:08" from="d197a10d487f4feca76eaaa52539564d" to="270ad5efb5d64112afacbeca5ffeca86" visibility="package">
@@ -5485,14 +5546,14 @@
                       <stereotype id="39db4851d2f34131ba16e6788ed23770_consuption_c" type="consuption" ref="" />
                     </stereotype-instances>
                     <relation from="d197a10d487f4feca76eaaa52539564d" to="270ad5efb5d64112afacbeca5ffeca86" derived="false">
-                      <start-role id="umlar-3463866c-bfef-4012-baf3-bf58f34c7e20" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
-                      <end-role id="umlar-3e60c7b3-b62c-42fa-abfd-3957233515cc" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <start-role id="umlar-dfdf41c7-5c55-4651-9d6d-349dbff2ce03" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <end-role id="umlar-c32344f6-303a-4f18-bb3b-25fcfe8d3d88" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
                     </relation>
                   </item>
                   <item id="b67adb8f034c4b75a300bd2f45ac7be9" cid="REL040" type="relationship" name="CurrentBillingPlan" style-class="" change-tracking-state="added" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 12:59:55" from="4603ec6ea7b8400d81d3a658cd91d7b2" to="270ad5efb5d64112afacbeca5ffeca86" visibility="package">
                     <relation from="4603ec6ea7b8400d81d3a658cd91d7b2" to="270ad5efb5d64112afacbeca5ffeca86" derived="false">
-                      <start-role id="umlar-43742c3d-5b14-45bb-ba2e-87c8341119e8" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
-                      <end-role id="umlar-9858383a-6e71-43b7-9f56-7bba62d05dba" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <start-role id="umlar-f75760c3-60b8-4595-85c6-3a7be9a46883" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
+                      <end-role id="umlar-bcc3eabb-ba13-4e32-b604-7a433c6ef07c" name="" multiplicity="1" navigability="" association-type="association" visibility="public" />
                     </relation>
                   </item>
                   <item id="678131d8520145c6997158360e81dc10" cid="PROP001" type="property" name="IsGold" style-class="" owner="13a6b5d699e34724b34d2f0e3cf411f6" creator="CDoZfQE0eoPT0twKUywpA2Pd3T+96zsw7WLZGMEzIl1z2XhR" creation-date="07/30/2021 13:01:17" visibility="private">
@@ -5752,7 +5813,7 @@
               </diagram>
             </model>
           </sub-models>
-          <diagram type="sysml-requirement" id="p5e6eff0804874c7f97ebec5f6c90954a_770964511" name="Requirements" order-index="0" uid="" show-id="false" show-name="true" show-parent-name="false" name-style="local-auto-parents" show-stereotypes="true" show-tagged-values="false" show-template-parameters="true" show-fields="true" show-field-tags="true" show-empty-compartments="true" show-special-indicators="false" show-rules="true" show-attributes="true" show-attribute-visibility="true" show-operations="true" show-operation-parameters="true" show-operation-visibility="true" show-visibility-sign="true" show-nullability="true" show-sequence-number="false" show-extension-points="false" show-relationship-texts="true" show-data="true" show-description="false" show-field-description="false" auto-routed-paths="false" default-line-style="default" show-frame="false">
+          <diagram type="sysml-requirement" id="p5e6eff0804874c7f97ebec5f6c90954a_770964511" name="Requirements" order-index="0" expanded="true" uid="" show-id="false" show-name="true" show-parent-name="false" name-style="local-auto-parents" show-stereotypes="true" show-tagged-values="false" show-template-parameters="true" show-fields="true" show-field-tags="true" show-empty-compartments="true" show-special-indicators="false" show-rules="true" show-attributes="true" show-attribute-visibility="true" show-operations="true" show-operation-parameters="true" show-operation-visibility="true" show-visibility-sign="true" show-nullability="true" show-sequence-number="false" show-extension-points="false" show-relationship-texts="true" show-data="true" show-description="false" show-field-description="false" auto-routed-paths="false" default-line-style="default" show-frame="false" view-location="0,-255">
             <style>
               <background-color index="1" color="#FFFFFFFF" />
               <background-color index="2" color="#FFFFFFFF" />
@@ -6030,7 +6091,7 @@
           </diagram>
         </model>
       </sub-models>
-      <diagram type="computer-network" id="pd58be3928ea5459a9674ebb2639df572_697594409" name="InfrastructureTopology" order-index="1" uid="" show-id="false" show-name="true" show-parent-name="false" name-style="local-auto-parents" show-stereotypes="true" show-tagged-values="false" show-template-parameters="true" show-fields="true" show-field-tags="true" show-empty-compartments="true" show-special-indicators="false" show-rules="true" show-attributes="true" show-attribute-visibility="true" show-operations="true" show-operation-parameters="true" show-operation-visibility="true" show-visibility-sign="true" show-nullability="true" show-sequence-number="false" show-extension-points="false" show-relationship-texts="true" show-data="true" show-description="false" show-field-description="false" auto-routed-paths="false" default-line-style="default">
+      <diagram type="computer-network" id="pd58be3928ea5459a9674ebb2639df572_697594409" name="InfrastructureTopology" order-index="1" uid="" show-id="false" show-name="true" show-parent-name="false" name-style="local-auto-parents" show-stereotypes="true" show-tagged-values="false" show-template-parameters="true" show-fields="true" show-field-tags="true" show-empty-compartments="true" show-special-indicators="false" show-rules="true" show-attributes="true" show-attribute-visibility="true" show-operations="true" show-operation-parameters="true" show-operation-visibility="true" show-visibility-sign="true" show-nullability="true" show-sequence-number="false" show-extension-points="false" show-relationship-texts="true" show-data="true" show-description="false" show-field-description="false" auto-routed-paths="false" default-line-style="default" view-location="0,-247">
         <style>
           <background-color index="1" color="#FFFFFFFF" />
           <background-color index="2" color="#FFFFFFFF" />

+ 24 - 24
AppServer/Data/Entity/Artifact.cs

@@ -1,24 +1,24 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Artifact
-    {
-        // // public long Id { get; set; }
-        public long MetadocumentId { get; set; }
-        public string Name { get; set; }
-        public string Extension { get; set; }
-        public long MimeTypeId { get; set; }
-        public int Type { get; set; }
-        public long Length { get; set; }
-        public DateTime Created { get; set; }
-        public long CreatedByUserId { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual Metadocument Metadocument { get; set; }
-        public virtual MimeType MimeType { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Artifact
+    {
+        // public long Id { get; set; }
+        public long MetadocumentId { get; set; }
+        public string Name { get; set; }
+        public string Extension { get; set; }
+        public long MimeTypeId { get; set; }
+        public int Type { get; set; }
+        public long Length { get; set; }
+        public DateTime Created { get; set; }
+        public long CreatedByUserId { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual Metadocument Metadocument { get; set; }
+        public virtual MimeType MimeType { get; set; }
+    }
+}

+ 1225 - 1216
AppServer/Data/Entity/BOContext.cs

@@ -1,1216 +1,1225 @@
-using Microsoft.EntityFrameworkCore;
-using Quadarax.Foundation.Core.Data.Domain;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class BOContext : DataDomain
-    {
-
-        public virtual DbSet<Artifact> Artifacts { get; set; }
-        public virtual DbSet<BillingInfo> BillingInfos { get; set; }
-        public virtual DbSet<BillingPlan> BillingPlans { get; set; }
-        public virtual DbSet<Invoice> Invoices { get; set; }
-        public virtual DbSet<InvoiceIssuer> InvoiceIssuers { get; set; }
-        public virtual DbSet<InvoiceItem> InvoiceItems { get; set; }
-        public virtual DbSet<Metadocument> Metadocuments { get; set; }
-        public virtual DbSet<MetadocumentBilling> MetadocumentBillings { get; set; }
-        public virtual DbSet<MetadocumentTag> MetadocumentTags { get; set; }
-        public virtual DbSet<MimeType> MimeTypes { get; set; }
-        public virtual DbSet<Registration> Registrations { get; set; }
-        public virtual DbSet<Statistic> Statistics { get; set; }
-        public virtual DbSet<StatusHistory> StatusHistories { get; set; }
-        public virtual DbSet<Structure> Structures { get; set; }
-        public virtual DbSet<Tag> Tags { get; set; }
-        public virtual DbSet<User> Users { get; set; }
-        public virtual DbSet<UserWorkspace> UserWorkspaces { get; set; }
-        public virtual DbSet<Workspace> Workspaces { get; set; }
-        public virtual DbSet<WorkspaceBilling> WorkspaceBillings { get; set; }
-
-        protected override void OnModelCreating(ModelBuilder modelBuilder)
-        {
-            modelBuilder.HasAnnotation("Relational:Collation", "Czech_CI_AS");
-
-            modelBuilder.Entity<Artifact>(entity =>
-            {
-                entity.ToTable("Artifact");
-
-                entity.HasComment("Stores single part of metadocument (called artifact). Refresents fingle physical file included for processing.");
-
-                entity.Property(e => e.Id).HasComment("Primary key of artifact record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when artifact was created (uploaded)");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) artifact");
-
-                entity.Property(e => e.Extension)
-                    .HasMaxLength(10)
-                    .HasComment("Artifact file  extension");
-
-                entity.Property(e => e.Length).HasComment("Defines file content length in bytes");
-
-                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
-
-                entity.Property(e => e.MimeTypeId).HasComment("Reference to MIME Type enumeration");
-
-                entity.Property(e => e.Name)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Artifact file name without extension");
-
-                entity.Property(e => e.Type).HasComment("Defines type of artifact. 0 - Input, 1 - Output");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.Artifacts)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Artifact_User_Created");
-
-                entity.HasOne(d => d.Metadocument)
-                    .WithMany(p => p.Artifacts)
-                    .HasForeignKey(d => d.MetadocumentId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Artifact_Metadocument");
-
-                entity.HasOne(d => d.MimeType)
-                    .WithMany(p => p.Artifacts)
-                    .HasForeignKey(d => d.MimeTypeId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Artifact_MimeType");
-            });
-
-            modelBuilder.Entity<BillingInfo>(entity =>
-            {
-                entity.ToTable("BillingInfo");
-
-                entity.HasComment("Workspace billing information for invoicing");
-
-                entity.Property(e => e.Id).HasComment("Primary key of billing information record");
-
-                entity.Property(e => e.Address1)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing Address line 1");
-
-                entity.Property(e => e.Address2)
-                    .HasMaxLength(200)
-                    .HasComment("Billing Address line 2");
-
-                entity.Property(e => e.City)
-                    .IsRequired()
-                    .HasMaxLength(100)
-                    .HasComment("Billing Address city");
-
-                entity.Property(e => e.Country)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .HasComment("Billing Address country");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing info was created");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
-
-                entity.Property(e => e.Email)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasComment("Billing email");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing info was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
-
-                entity.Property(e => e.Phone)
-                    .HasMaxLength(20)
-                    .HasComment("Billing phone with format +XXXXXXXXX");
-
-                entity.Property(e => e.SubjectName)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing Subject name");
-
-                entity.Property(e => e.TaxNumber)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasComment("Billing Tax number");
-
-                entity.Property(e => e.Vatnumber)
-                    .HasMaxLength(20)
-                    .HasColumnName("VATNumber")
-                    .HasComment("Billing VAT number");
-
-                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
-
-                entity.Property(e => e.Zip)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasColumnName("ZIP")
-                    .HasComment("Billing Address ZIP");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.BillingInfoCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_BillingInfo_User_Created");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.BillingInfoModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_BillingInfo_User_Modified");
-
-
-                //entity.HasOne(d => d.Workspace)
-                //    .WithMany(p => p.BillingInfos)
-                //    .HasForeignKey(d => d.WorkspaceId)
-                //    .OnDelete(DeleteBehavior.ClientSetNull)
-                //    .HasConstraintName("REL_BillingInfo_Workspace");
-            });
-
-            modelBuilder.Entity<BillingPlan>(entity =>
-            {
-                entity.ToTable("BillingPlan");
-
-                entity.HasComment("Defines global Billing plan strategies (how to bill document processing in workspace). This table is managed only with administrator.");
-
-                entity.Property(e => e.Id).HasComment("Primary key of BillingPlan record");
-
-                entity.Property(e => e.Code)
-                    .IsRequired()
-                    .HasMaxLength(10)
-                    .HasComment("Billing plan short code");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when metadocument was created (uploaded)");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
-
-                entity.Property(e => e.Currency)
-                    .IsRequired()
-                    .HasMaxLength(3)
-                    .IsUnicode(false)
-                    .HasComment("Billing plan price currency");
-
-                entity.Property(e => e.Description)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing plan short description");
-
-                entity.Property(e => e.IsCustom).HasComment("Flag if billing plan is custom dependent");
-
-                entity.Property(e => e.IsEnabled).HasComment("Flag if record is active, otherwise shuld be delete");
-
-                entity.Property(e => e.IsHidden).HasComment("Flag if billing plan is private for use, only SuperAdmin can use it");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when metadocument was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument");
-
-                entity.Property(e => e.Name)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing plan name");
-
-                entity.Property(e => e.Price)
-                    .HasColumnType("decimal(18, 0)")
-                    .HasComment("Billing plan price");
-
-                entity.Property(e => e.PstcreditsPerItem)
-                    .HasColumnName("PSTCreditsPerItem")
-                    .HasComment("Preset - single item credit cost");
-
-                entity.Property(e => e.PstinitialCredits)
-                    .HasColumnName("PSTInitialCredits")
-                    .HasComment("Preset - initial credit amount");
-
-                entity.Property(e => e.PstprocessProfile)
-                    .HasMaxLength(5)
-                    .IsUnicode(false)
-                    .HasColumnName("PSTProcessProfile")
-                    .HasComment("Preset - processing profile code");
-
-                entity.Property(e => e.Pstquality)
-                    .HasColumnName("PSTQuality")
-                    .HasComment("Preset - process quality 0 = lowest");
-
-                entity.Property(e => e.Psttest)
-                    .HasColumnName("PSTTest")
-                    .HasComment("Preset - testing mode");
-
-                entity.Property(e => e.Pstwatermark)
-                    .HasColumnName("PSTWatermark")
-                    .HasComment("Preset - watermarked");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.BillingPlanCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_BillingPlan_User_Created");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.BillingPlanModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_BillingPlan_User_Modified");
-            });
-
-            modelBuilder.Entity<Invoice>(entity =>
-            {
-                entity.ToTable("Invoice");
-
-                entity.HasComment("Stores invoice information of Workspace BusinessPlan ");
-
-                entity.Property(e => e.Id).HasComment("Primary key of invoice record");
-
-                entity.Property(e => e.Address1)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing Address line 1");
-
-                entity.Property(e => e.Address2)
-                    .HasMaxLength(200)
-                    .HasComment("Billing Address line 2");
-
-                entity.Property(e => e.Channel)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasComment("Pay channel");
-
-                entity.Property(e => e.ChannelReference)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .HasComment("Pay channel reference (account number)");
-
-                entity.Property(e => e.City)
-                    .IsRequired()
-                    .HasMaxLength(100)
-                    .HasComment("Billing Address city");
-
-                entity.Property(e => e.Code)
-                    .IsRequired()
-                    .HasMaxLength(12)
-                    .IsUnicode(false)
-                    .HasComment("Invoice number");
-
-                entity.Property(e => e.Country)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .HasComment("Billing Address country");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing info was created");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
-
-                entity.Property(e => e.DueDate)
-                    .HasColumnType("datetime")
-                    .HasComment("Due date");
-
-                entity.Property(e => e.Email)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasComment("Billing email");
-
-                entity.Property(e => e.InvoiceIssuerId).HasComment("Reference to invoice issuer record");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing info was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
-
-                entity.Property(e => e.Phone)
-                    .HasMaxLength(20)
-                    .HasComment("Billing phone with format +XXXXXXXXX");
-
-                entity.Property(e => e.SubjectName)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing Subject name");
-
-                entity.Property(e => e.TaxDate)
-                    .HasColumnType("datetime")
-                    .HasComment("Tax date");
-
-                entity.Property(e => e.TaxNumber)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasComment("Billing Tax number");
-
-                entity.Property(e => e.TotalBaseCurrency)
-                    .IsRequired()
-                    .HasMaxLength(3)
-                    .IsUnicode(false)
-                    .HasComment("Total base price currency (w/o VAT)");
-
-                entity.Property(e => e.TotalBasePrice)
-                    .HasColumnType("decimal(16, 4)")
-                    .HasComment("Total base price (w/o VAT)");
-
-                entity.Property(e => e.Vatnumber)
-                    .HasMaxLength(20)
-                    .HasColumnName("VATNumber")
-                    .HasComment("Billing VAT number");
-
-                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
-
-                entity.Property(e => e.Zip)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasColumnName("ZIP")
-                    .HasComment("Billing Address ZIP");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.InvoiceCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Invoice_User_Created");
-
-                entity.HasOne(d => d.InvoiceIssuer)
-                    .WithMany(p => p.Invoices)
-                    .HasForeignKey(d => d.InvoiceIssuerId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Invoice_InvoiceIssuer");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.InvoiceModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_Invoice_User_Modified");
-
-                entity.HasOne(d => d.Workspace)
-                    .WithMany(p => p.Invoices)
-                    .HasForeignKey(d => d.WorkspaceId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Invoice_Workspace");
-            });
-
-            modelBuilder.Entity<InvoiceIssuer>(entity =>
-            {
-                entity.ToTable("InvoiceIssuer");
-
-                entity.HasComment("Defines information about Invoice Issuer and its contacts information (used in invoice header)");
-
-                entity.Property(e => e.Id).HasComment("Primary key of invoice issuer record");
-
-                entity.Property(e => e.Address1)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing Address line 1");
-
-                entity.Property(e => e.Address2)
-                    .HasMaxLength(200)
-                    .HasComment("Billing Address line 2");
-
-                entity.Property(e => e.City)
-                    .IsRequired()
-                    .HasMaxLength(100)
-                    .HasComment("Billing Address city");
-
-                entity.Property(e => e.Country)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .HasComment("Billing Address country");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing info was created");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
-
-                entity.Property(e => e.Email)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasComment("Billing email");
-
-                entity.Property(e => e.IsEnabled).HasComment("Flag if record is enabled");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing info was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
-
-                entity.Property(e => e.Phone)
-                    .HasMaxLength(20)
-                    .HasComment("Billing phone with format +XXXXXXXXX");
-
-                entity.Property(e => e.SubjectName)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Billing Subject name");
-
-                entity.Property(e => e.TaxNumber)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasComment("Billing Tax number");
-
-                entity.Property(e => e.Vatnumber)
-                    .HasMaxLength(20)
-                    .HasColumnName("VATNumber")
-                    .HasComment("Billing VAT number");
-
-                entity.Property(e => e.Zip)
-                    .IsRequired()
-                    .HasMaxLength(20)
-                    .HasColumnName("ZIP")
-                    .HasComment("Billing Address ZIP");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.InvoiceIssuerCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_InvoiceIssuer_User_Created");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.InvoiceIssuerModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_InvoiceIssuer_User_Modified");
-            });
-
-            modelBuilder.Entity<InvoiceItem>(entity =>
-            {
-                entity.ToTable("InvoiceItem");
-
-                entity.HasComment("Invoice item");
-
-                entity.Property(e => e.Id).HasComment("Primary key of invoice item record");
-
-                entity.Property(e => e.BillingPlanCode)
-                    .IsRequired()
-                    .HasMaxLength(10)
-                    .HasComment("Billing plan short code");
-
-                entity.Property(e => e.BillingPlanId).HasComment("Reference to billing plan");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing info was created");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
-
-                entity.Property(e => e.InvoiceId).HasComment("Reference to owning invoice");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing info was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
-
-                entity.Property(e => e.UnitBaseCurrency)
-                    .IsRequired()
-                    .HasMaxLength(3)
-                    .IsUnicode(false)
-                    .HasComment("Unit base price currency (w/o VAT)");
-
-                entity.Property(e => e.UnitBasePrice)
-                    .HasColumnType("decimal(16, 4)")
-                    .HasComment("Unit base price (w/o VAT)");
-
-                entity.Property(e => e.UnitQuantity)
-                    .HasDefaultValueSql("((1))")
-                    .HasComment("Unit quantity");
-
-                entity.HasOne(d => d.BillingPlan)
-                    .WithMany(p => p.InvoiceItems)
-                    .HasForeignKey(d => d.BillingPlanId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_InvoiceItem_BillingPlan");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.InvoiceItemCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_InvoiceItem_User_Created");
-
-                entity.HasOne(d => d.Invoice)
-                    .WithMany(p => p.InvoiceItems)
-                    .HasForeignKey(d => d.InvoiceId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_InvoiceItem_Invoice");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.InvoiceItemModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_InvoiceItem_User_Modified");
-            });
-
-            modelBuilder.Entity<Metadocument>(entity =>
-            {
-                entity.ToTable("Metadocument");
-
-                entity.HasComment("Abstract single document header to process. Has setting parameters for computing and status");
-
-                entity.Property(e => e.Id).HasComment("Primary key of metadocument record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when metadocument was created (uploaded)");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
-
-                entity.Property(e => e.LastDowloaded)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when metadocument was last downloaded");
-
-                entity.Property(e => e.LastDownloadedByUserId).HasComment("Reference to user who last metadocument dowloaded");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when metadocument was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument");
-
-                entity.Property(e => e.Name)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Metadocument name");
-
-                entity.Property(e => e.Status).HasComment("Metadocument status");
-
-                entity.Property(e => e.StructureId).HasComment("Reference to owning structure (workspace)");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.MetadocumentCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Metadocument_User_Created");
-
-                entity.HasOne(d => d.LastDownloadedByUser)
-                    .WithMany(p => p.MetadocumentLastDownloadedByUsers)
-                    .HasForeignKey(d => d.LastDownloadedByUserId)
-                    .HasConstraintName("REL_Metadocument_User_Downloaded");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.MetadocumentModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_Metadocument_User_Modified");
-
-                entity.HasOne(d => d.Structure)
-                    .WithMany(p => p.Metadocuments)
-                    .HasForeignKey(d => d.StructureId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Metadocument_Structure");
-            });
-
-            modelBuilder.Entity<MetadocumentBilling>(entity =>
-            {
-                entity.HasNoKey();
-
-                entity.ToTable("MetadocumentBilling");
-
-                entity.HasComment("Association of metadocument and billing plan with properties. Stores information about processed documents (name, status timestamps, etc.) relates to workspace billing plan selection.");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing was created");
-
-                entity.Property(e => e.CreditCost).HasComment("Numeric value of billing plan spending. Depends on BillingPlan.");
-
-                entity.Property(e => e.Downloaded)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when document was last downloaded");
-
-                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing was modified");
-
-                entity.Property(e => e.Procesed)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when document was processed");
-
-                entity.Property(e => e.ProcessProfile)
-                    .HasMaxLength(5)
-                    .IsUnicode(false)
-                    .HasComment("Processing profile code");
-
-                entity.Property(e => e.ProcessStart)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when document set to processing state");
-
-                entity.Property(e => e.ProcessState).HasComment("Last state of processing (OK,Fail)");
-
-                entity.Property(e => e.Psinstance)
-                    .HasMaxLength(100)
-                    .IsUnicode(false)
-                    .HasColumnName("PSInstance")
-                    .HasComment("Process server instance identifier");
-
-                entity.Property(e => e.Quality).HasComment("Process quality 0 = lowest");
-
-                entity.Property(e => e.Test).HasComment("Flag if testing mode");
-
-                entity.Property(e => e.Watermark).HasComment("Flag if watermarked");
-
-                entity.Property(e => e.WorkspaceBillingId).HasComment("Reference to workspace billing plan");
-
-                entity.HasOne(d => d.Metadocument)
-                    .WithMany()
-                    .HasForeignKey(d => d.MetadocumentId)
-                    .HasConstraintName("REL_MetadocumentBilling_Metadocument");
-
-                entity.HasOne(d => d.WorkspaceBilling)
-                    .WithMany()
-                    .HasForeignKey(d => d.WorkspaceBillingId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_MetadocumentBilling_WorkspaceBilling");
-            });
-
-            modelBuilder.Entity<MetadocumentTag>(entity =>
-            {
-                entity.HasNoKey();
-
-                entity.ToTable("MetadocumentTag");
-
-                entity.HasComment("Association of metadocument and tag");
-
-                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
-
-                entity.Property(e => e.TagId).HasComment("Reference to Tag");
-
-                entity.HasOne(d => d.Metadocument)
-                    .WithMany()
-                    .HasForeignKey(d => d.MetadocumentId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_MetadocumentTag_Metadocument");
-
-                entity.HasOne(d => d.Tag)
-                    .WithMany()
-                    .HasForeignKey(d => d.TagId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_MetadocumentTag_Tag");
-            });
-
-            modelBuilder.Entity<MimeType>(entity =>
-            {
-                entity.ToTable("MimeType");
-
-                entity.HasComment("MIME Types global enumeration. Defines file extension and MIME type association, This table is managed only with administrator.");
-
-                entity.Property(e => e.Id).HasComment("Primary key of MIMEType record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when metadocument was created (uploaded)");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
-
-                entity.Property(e => e.Description)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Short description of MIMEType");
-
-                entity.Property(e => e.Extensions)
-                    .IsRequired()
-                    .HasMaxLength(500)
-                    .HasComment("Extensions for mime type separated by semicolomn (example cad; cat; txt)");
-
-                entity.Property(e => e.IsEnabled).HasComment("Flag if record is active, otherwise shuld be delete");
-
-                entity.Property(e => e.Mimetype1)
-                    .IsRequired()
-                    .HasMaxLength(500)
-                    .HasColumnName("MIMEType")
-                    .HasComment("MIMEType code");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when metadocument was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.MimeTypeCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_MimeType_User_Created");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.MimeTypeModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_MimeType_User_Modified");
-            });
-
-            modelBuilder.Entity<Registration>(entity =>
-            {
-                entity.ToTable("Registration");
-
-                entity.HasComment("Holds Process Server registrations");
-
-                entity.Property(e => e.Id).HasComment("Primary key of Registration record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when registration was created");
-
-                entity.Property(e => e.DocumentFailedCnt).HasComment("# of failed documents");
-
-                entity.Property(e => e.DocumentProcessedCnt).HasComment("# of new processed documents");
-
-                entity.Property(e => e.LastActivity)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp latest activity");
-
-                entity.Property(e => e.LocationIp)
-                    .HasMaxLength(100)
-                    .IsUnicode(false)
-                    .HasColumnName("LocationIP")
-                    .HasComment("Process server instance identifier");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when registration was modified");
-
-                entity.Property(e => e.Psinstance)
-                    .HasMaxLength(100)
-                    .IsUnicode(false)
-                    .HasColumnName("PSInstance")
-                    .HasComment("Process server instance identifier");
-            });
-
-            modelBuilder.Entity<Statistic>(entity =>
-            {
-                entity.ToTable("Statistic");
-
-                entity.HasComment("Holds statistics information on daily base");
-
-                entity.HasIndex(e => new { e.Year, e.Month, e.Day }, "IDX_DATE")
-                    .IsUnique();
-
-                entity.Property(e => e.Id).HasComment("Primary key of Statistic record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing info was created");
-
-                entity.Property(e => e.Day).HasComment("Day number");
-
-                entity.Property(e => e.DocumentDownloadedCnt).HasComment("# of downloaded documents");
-
-                entity.Property(e => e.DocumentFailedCnt).HasComment("# of failed documents");
-
-                entity.Property(e => e.DocumentNewCnt).HasComment("# of new created/uploaded documents");
-
-                entity.Property(e => e.DocumentProcessedCnt).HasComment("# of processed documents");
-
-                entity.Property(e => e.DocumentTotalCnt).HasComment("# of all available documents");
-
-                entity.Property(e => e.InvoiceNewCnt).HasComment("# of new created invoices");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing info was modified");
-
-                entity.Property(e => e.Month).HasComment("Month number");
-
-                entity.Property(e => e.PsactiveCnt)
-                    .HasColumnName("PSActiveCnt")
-                    .HasComment("# of active ProcessServer instances");
-
-                entity.Property(e => e.UserLoginB2bcnt)
-                    .HasColumnName("UserLoginB2BCnt")
-                    .HasComment("# of logged B2B users");
-
-                entity.Property(e => e.UserLoginCnt).HasComment("# of logged users (incl B2B)");
-
-                entity.Property(e => e.UserNewCnt).HasComment("# of new created users");
-
-                entity.Property(e => e.UserTotalCnt).HasComment("# of all users (incl system)");
-
-                entity.Property(e => e.WorkspaceNewCnt).HasComment("# of new created workspaces");
-
-                entity.Property(e => e.WorkspaceTotalCnt).HasComment("# of all workspaces");
-
-                entity.Property(e => e.Year).HasComment("Year number");
-
-                entity.Property(e => e.YieldWorthCurrency)
-                    .IsRequired()
-                    .HasMaxLength(3)
-                    .IsUnicode(false)
-                    .HasComment("currency code of yieldworth");
-
-                entity.Property(e => e.YieldWorthSum)
-                    .HasColumnType("decimal(16, 4)")
-                    .HasComment("sum of daily yield worth");
-
-                entity.Property(e => e.YieldWorthTotalCurrency)
-                    .IsRequired()
-                    .HasMaxLength(3)
-                    .IsUnicode(false)
-                    .HasComment("currency code of yieldworth");
-
-                entity.Property(e => e.YieldWorthTotalSum)
-                    .HasColumnType("decimal(16, 4)")
-                    .HasComment("sum of daily yield worth");
-            });
-
-            modelBuilder.Entity<StatusHistory>(entity =>
-            {
-                entity.ToTable("StatusHistory");
-
-                entity.HasComment("Stores metadocument status changing log with messages");
-
-                entity.Property(e => e.Id).HasComment("Primary key of metadocument status history record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when metadocument was created (uploaded)");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
-
-                entity.Property(e => e.Message)
-                    .HasMaxLength(4000)
-                    .HasComment("Status change message or error message. This value is optional.");
-
-                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
-
-                entity.Property(e => e.Status).HasComment("Metadocument status");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.StatusHistories)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_StatusHistory_User_Created");
-
-                entity.HasOne(d => d.Metadocument)
-                    .WithMany(p => p.StatusHistories)
-                    .HasForeignKey(d => d.MetadocumentId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_StatusHistory_Metadocument");
-            });
-
-            modelBuilder.Entity<Structure>(entity =>
-            {
-                entity.ToTable("Structure");
-
-                entity.HasComment("Abstract repository structure (folder-like) where documents are assignig");
-
-                entity.Property(e => e.Id).HasComment("Structure primary key");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when workspace was created");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created workspace");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when workspace was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated workspace");
-
-                entity.Property(e => e.Name)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Structure name");
-
-                entity.Property(e => e.ParentId).HasComment("Reference to parent structure (folder). If null then record is root");
-
-                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
-
-                entity.HasOne(d => d.Parent)
-                    .WithMany(p => p.InverseParent)
-                    .HasForeignKey(d => d.ParentId)
-                    .HasConstraintName("REL_Structure_Structure_Parent");
-
-                entity.HasOne(d => d.Workspace)
-                    .WithMany(p => p.Structures)
-                    .HasForeignKey(d => d.WorkspaceId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Structure_Workspace");
-            });
-
-            modelBuilder.Entity<Tag>(entity =>
-            {
-                entity.ToTable("Tag");
-
-                entity.HasComment("Declares tag for workspace scope. Tag is used on metadocument.");
-
-                entity.Property(e => e.Id).HasComment("Primary key of tag record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing info was created");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing info was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
-
-                entity.Property(e => e.Name)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .HasComment("Tag name");
-
-                entity.Property(e => e.Rgb)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .IsUnicode(false)
-                    .HasColumnName("RGB")
-                    .HasComment("Tag color in RGB format");
-
-                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.TagCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Tag_User_Created");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.TagModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_Tag_User_Modified");
-
-                entity.HasOne(d => d.Workspace)
-                    .WithMany(p => p.Tags)
-                    .HasForeignKey(d => d.WorkspaceId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Tag_Workspace");
-            });
-
-            modelBuilder.Entity<User>(entity =>
-            {
-                entity.ToTable("User");
-
-                entity.HasComment("User identity with properties");
-
-                entity.HasIndex(e => e.Ifreference, "IDX_IFREFERENCE")
-                    .IsUnique();
-
-                entity.HasIndex(e => e.Name, "IDX_USER_NAME")
-                    .IsUnique();
-
-                entity.Property(e => e.Id).HasComment("User primary key");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when user was created");
-
-                entity.Property(e => e.Ifreference)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .IsUnicode(false)
-                    .HasColumnName("IFReference")
-                    .HasComment("Reference to Identity framework IdentityUser.Id");
-
-                entity.Property(e => e.IsEnabled).HasComment("Flag if user can sign on");
-
-                entity.Property(e => e.IsSystem).HasComment("Flag if user is system only account. Cannot log in.");
-
-                entity.Property(e => e.LangLcid)
-                    .HasColumnName("LangLCID")
-                    .HasDefaultValueSql("((1033))")
-                    .HasComment("LCID of preffered user language");
-
-                entity.Property(e => e.LastDisabled)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp of last user set to be disabled");
-
-                entity.Property(e => e.LastEnabled)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp of last user set to be enabled");
-
-                entity.Property(e => e.LastLogged)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp of user last successful login");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when user was modified");
-
-                entity.Property(e => e.Name)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Full user name");
-            });
-
-            modelBuilder.Entity<UserWorkspace>(entity =>
-            {
-                // entity.HasNoKey();
-
-                entity.ToTable("UserWorkspace");
-
-                entity.HasComment("Association between User and Workspace. Which Workspace is assigned to user.");
-
-                entity.Property(e => e.IsDefault).HasComment("Flag if relation is default");
-
-                entity.Property(e => e.UserId).HasComment("Reference to user record");
-
-                entity.Property(e => e.WorkspaceId).HasComment("Reference to workspace record");
-
-                entity.HasOne(d => d.User)
-                    .WithMany()
-                    .HasForeignKey(d => d.UserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_UserWorkspace_User");
-
-                entity.HasOne(d => d.Workspace)
-                    .WithMany()
-                    .HasForeignKey(d => d.WorkspaceId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_UserWorkspace_Workspace");
-            });
-
-            modelBuilder.Entity<Workspace>(entity =>
-            {
-                entity.ToTable("Workspace");
-
-                entity.HasComment("Main workspace root structure holds information about working space (set of documents) and their business plan");
-
-                entity.Property(e => e.Id).HasComment("Workspace primary key");
-
-                entity.Property(e => e.Apikey)
-                    .HasColumnName("APIKey")
-                    .HasDefaultValueSql("(newid())")
-                    .HasComment("API Key for access to workspace via B2B interface");
-
-                entity.Property(e => e.Apipassword)
-                    .IsRequired()
-                    .HasMaxLength(50)
-                    .HasColumnName("APIPassword")
-                    .HasComment("API Key Password for access to workspace via B2B interface");
-
-                entity.Property(e => e.BillingInfoId).HasComment("Reference to current billing info record");
-
-                entity.Property(e => e.BillingPlanId).HasComment("Reference to current billing plan record");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when workspace was created");
-
-                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created workspace");
-
-                entity.Property(e => e.IsGold).HasComment("Define if workspace is GOLD mode (has custom billing plan)");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when workspace was modified");
-
-                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated workspace");
-
-                entity.Property(e => e.Name)
-                    .IsRequired()
-                    .HasMaxLength(200)
-                    .HasComment("Workspace name");
-
-                //entity.HasOne(d => d.BillingInfo)
-                //    .WithMany(p => p.Workspaces)
-                //    .HasForeignKey(d => d.BillingInfoId)
-                //    .HasConstraintName("REL_Workspace_BillingInfo");
-
-                entity.HasOne(d => d.CreatedByUser)
-                    .WithMany(p => p.WorkspaceCreatedByUsers)
-                    .HasForeignKey(d => d.CreatedByUserId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_Workspace_User_Created");
-
-                entity.HasOne(d => d.ModifiedByUser)
-                    .WithMany(p => p.WorkspaceModifiedByUsers)
-                    .HasForeignKey(d => d.ModifiedByUserId)
-                    .HasConstraintName("REL_Workspace_User_Modified");
-
-            });
-
-            modelBuilder.Entity<WorkspaceBilling>(entity =>
-            {
-                entity.ToTable("WorkspaceBilling");
-
-                entity.HasComment("Deffines current state of billing plan for workspace");
-
-                entity.Property(e => e.Id).HasComment("Primary key of WorkspaceBilling record");
-
-                entity.Property(e => e.BillingPlanId).HasComment("Reference to billing plan");
-
-                entity.Property(e => e.Created)
-                    .HasColumnType("datetime")
-                    .HasDefaultValueSql("(getdate())")
-                    .HasComment("Timestamp when billing was created");
-
-                entity.Property(e => e.CustomPstcreditsPerItem)
-                    .HasColumnName("CustomPSTCreditsPerItem")
-                    .HasComment("Custom Preset Override - single item credit cost");
-
-                entity.Property(e => e.CustomPstinitialCredits)
-                    .HasColumnName("CustomPSTInitialCredits")
-                    .HasComment("Custom Preset Override - initial credit amount");
-
-                entity.Property(e => e.CustomPstprocessProfile)
-                    .HasMaxLength(5)
-                    .IsUnicode(false)
-                    .HasColumnName("CustomPSTProcessProfile")
-                    .HasComment("Custom Preset Override - processing profile code");
-
-                entity.Property(e => e.CustomPstquality)
-                    .HasColumnName("CustomPSTQuality")
-                    .HasComment("Custom Preset Override - process quality 0 = lowest");
-
-                entity.Property(e => e.CustomPsttest)
-                    .HasColumnName("CustomPSTTest")
-                    .HasComment("Custom Preset Override - testing mode");
-
-                entity.Property(e => e.CustomPstwatermark)
-                    .HasColumnName("CustomPSTWatermark")
-                    .HasComment("Custom Preset Override - watermarked");
-
-                entity.Property(e => e.Modified)
-                    .HasColumnType("datetime")
-                    .HasComment("Timestamp when billing was modified");
-
-                entity.Property(e => e.ValueDate)
-                    .HasColumnType("datetime")
-                    .HasComment("DateTime value of billing plan spending. Depends on BillingPlan");
-
-                entity.Property(e => e.ValueNumber)
-                    .HasColumnType("decimal(16, 4)")
-                    .HasComment("Numeric value of billing plan spending. Depends on BillingPlan.");
-
-                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
-
-                entity.HasOne(d => d.BillingPlan)
-                    .WithMany(p => p.WorkspaceBillings)
-                    .HasForeignKey(d => d.BillingPlanId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_WorkspaceBilling_BillingPlan");
-
-                entity.HasOne(d => d.Workspace)
-                    .WithMany(p => p.WorkspaceBillings)
-                    .HasForeignKey(d => d.WorkspaceId)
-                    .OnDelete(DeleteBehavior.ClientSetNull)
-                    .HasConstraintName("REL_WorkspaceBilling_Workspace");
-            });
-
-            OnModelCreatingPartial(modelBuilder);
-        }
-
-        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
-    }
-}
+using Microsoft.EntityFrameworkCore;
+using Quadarax.Foundation.Core.Data.Domain;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class BOContext : DataDomain
+    {
+        public BOContext(DbContextOptions<BOContext> options)
+            : base(options)
+        {
+        }
+
+        public virtual DbSet<Artifact> Artifacts { get; set; }
+        public virtual DbSet<BillingInfo> BillingInfos { get; set; }
+        public virtual DbSet<BillingPlan> BillingPlans { get; set; }
+        public virtual DbSet<Invoice> Invoices { get; set; }
+        public virtual DbSet<InvoiceIssuer> InvoiceIssuers { get; set; }
+        public virtual DbSet<InvoiceItem> InvoiceItems { get; set; }
+        public virtual DbSet<Metadocument> Metadocuments { get; set; }
+        public virtual DbSet<MetadocumentBilling> MetadocumentBillings { get; set; }
+        public virtual DbSet<MetadocumentTag> MetadocumentTags { get; set; }
+        public virtual DbSet<MimeType> MimeTypes { get; set; }
+        public virtual DbSet<Registration> Registrations { get; set; }
+        public virtual DbSet<Statistic> Statistics { get; set; }
+        public virtual DbSet<StatusHistory> StatusHistories { get; set; }
+        public virtual DbSet<Structure> Structures { get; set; }
+        public virtual DbSet<Tag> Tags { get; set; }
+        public virtual DbSet<User> Users { get; set; }
+        public virtual DbSet<UserWorkspace> UserWorkspaces { get; set; }
+        public virtual DbSet<Workspace> Workspaces { get; set; }
+        public virtual DbSet<WorkspaceBilling> WorkspaceBillings { get; set; }
+
+        protected override void OnModelCreating(ModelBuilder modelBuilder)
+        {
+            modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
+
+            modelBuilder.Entity<Artifact>(entity =>
+            {
+                entity.ToTable("Artifact");
+
+                entity.HasComment("Stores single part of metadocument (called artifact). Refresents fingle physical file included for processing.");
+
+                entity.Property(e => e.Id).HasComment("Primary key of artifact record");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when artifact was created (uploaded)");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) artifact");
+
+                entity.Property(e => e.Extension)
+                    .HasMaxLength(10)
+                    .HasComment("Artifact file  extension");
+
+                entity.Property(e => e.Length).HasComment("Defines file content length in bytes");
+
+                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
+
+                entity.Property(e => e.MimeTypeId).HasComment("Reference to MIME Type enumeration");
+
+                entity.Property(e => e.Name)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Artifact file name without extension");
+
+                entity.Property(e => e.Type).HasComment("Defines type of artifact. 0 - Input, 1 - Output");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.Artifacts)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Artifact_User_Created");
+
+                entity.HasOne(d => d.Metadocument)
+                    .WithMany(p => p.Artifacts)
+                    .HasForeignKey(d => d.MetadocumentId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Artifact_Metadocument");
+
+                entity.HasOne(d => d.MimeType)
+                    .WithMany(p => p.Artifacts)
+                    .HasForeignKey(d => d.MimeTypeId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Artifact_MimeType");
+            });
+
+            modelBuilder.Entity<BillingInfo>(entity =>
+            {
+                entity.ToTable("BillingInfo");
+
+                entity.HasComment("Workspace billing information for invoicing");
+
+                entity.Property(e => e.Id).HasComment("Primary key of billing information record");
+
+                entity.Property(e => e.Address1)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing Address line 1");
+
+                entity.Property(e => e.Address2)
+                    .HasMaxLength(200)
+                    .HasComment("Billing Address line 2");
+
+                entity.Property(e => e.City)
+                    .IsRequired()
+                    .HasMaxLength(100)
+                    .HasComment("Billing Address city");
+
+                entity.Property(e => e.Country)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .HasComment("Billing Address country");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing info was created");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
+
+                entity.Property(e => e.Email)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasComment("Billing email");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing info was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
+
+                entity.Property(e => e.Phone)
+                    .HasMaxLength(20)
+                    .HasComment("Billing phone with format +XXXXXXXXX");
+
+                entity.Property(e => e.SubjectName)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing Subject name");
+
+                entity.Property(e => e.TaxNumber)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasComment("Billing Tax number");
+
+                entity.Property(e => e.Vatnumber)
+                    .HasMaxLength(20)
+                    .HasColumnName("VATNumber")
+                    .HasComment("Billing VAT number");
+
+                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
+
+                entity.Property(e => e.Zip)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasColumnName("ZIP")
+                    .HasComment("Billing Address ZIP");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.BillingInfoCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_BillingInfo_User_Created");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.BillingInfoModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_BillingInfo_User_Modified");
+
+                //entity.HasOne(d => d.Workspace)
+                //    .WithMany(p => p.BillingInfos)
+                //    .HasForeignKey(d => d.WorkspaceId)
+                //    .OnDelete(DeleteBehavior.ClientSetNull)
+                //    .HasConstraintName("REL_BillingInfo_Workspace");
+            });
+
+            modelBuilder.Entity<BillingPlan>(entity =>
+            {
+                entity.ToTable("BillingPlan");
+
+                entity.HasComment("Defines global Billing plan strategies (how to bill document processing in workspace). This table is managed only with administrator.");
+
+                entity.Property(e => e.Id).HasComment("Primary key of BillingPlan record");
+
+                entity.Property(e => e.Code)
+                    .IsRequired()
+                    .HasMaxLength(10)
+                    .HasComment("Billing plan short code");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when metadocument was created (uploaded)");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
+
+                entity.Property(e => e.Currency)
+                    .IsRequired()
+                    .HasMaxLength(3)
+                    .IsUnicode(false)
+                    .HasComment("Billing plan price currency");
+
+                entity.Property(e => e.Description)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing plan short description");
+
+                entity.Property(e => e.IsCustom).HasComment("Flag if billing plan is custom dependent");
+
+                entity.Property(e => e.IsEnabled).HasComment("Flag if record is active, otherwise shuld be delete");
+
+                entity.Property(e => e.IsHidden).HasComment("Flag if billing plan is private for use, only SuperAdmin can use it");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when metadocument was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument");
+
+                entity.Property(e => e.Name)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing plan name");
+
+                entity.Property(e => e.Price)
+                    .HasColumnType("decimal(18, 0)")
+                    .HasComment("Billing plan price");
+
+                entity.Property(e => e.PstcreditsPerItem)
+                    .HasColumnName("PSTCreditsPerItem")
+                    .HasComment("Preset - single item credit cost");
+
+                entity.Property(e => e.PstinitialCredits)
+                    .HasColumnName("PSTInitialCredits")
+                    .HasComment("Preset - initial credit amount");
+
+                entity.Property(e => e.PstprocessProfile)
+                    .HasMaxLength(5)
+                    .IsUnicode(false)
+                    .HasColumnName("PSTProcessProfile")
+                    .HasComment("Preset - processing profile code");
+
+                entity.Property(e => e.Pstquality)
+                    .HasColumnName("PSTQuality")
+                    .HasComment("Preset - process quality 0 = lowest");
+
+                entity.Property(e => e.Psttest)
+                    .HasColumnName("PSTTest")
+                    .HasComment("Preset - testing mode");
+
+                entity.Property(e => e.Pstwatermark)
+                    .HasColumnName("PSTWatermark")
+                    .HasComment("Preset - watermarked");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.BillingPlanCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_BillingPlan_User_Created");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.BillingPlanModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_BillingPlan_User_Modified");
+            });
+
+            modelBuilder.Entity<Invoice>(entity =>
+            {
+                entity.ToTable("Invoice");
+
+                entity.HasComment("Stores invoice information of Workspace BusinessPlan ");
+
+                entity.Property(e => e.Id).HasComment("Primary key of invoice record");
+
+                entity.Property(e => e.Address1)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing Address line 1");
+
+                entity.Property(e => e.Address2)
+                    .HasMaxLength(200)
+                    .HasComment("Billing Address line 2");
+
+                entity.Property(e => e.Channel)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasComment("Pay channel");
+
+                entity.Property(e => e.ChannelReference)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .HasComment("Pay channel reference (account number)");
+
+                entity.Property(e => e.City)
+                    .IsRequired()
+                    .HasMaxLength(100)
+                    .HasComment("Billing Address city");
+
+                entity.Property(e => e.Code)
+                    .IsRequired()
+                    .HasMaxLength(12)
+                    .IsUnicode(false)
+                    .HasComment("Invoice number");
+
+                entity.Property(e => e.Country)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .HasComment("Billing Address country");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing info was created");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
+
+                entity.Property(e => e.DueDate)
+                    .HasColumnType("datetime")
+                    .HasComment("Due date");
+
+                entity.Property(e => e.Email)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasComment("Billing email");
+
+                entity.Property(e => e.InvoiceIssuerId).HasComment("Reference to invoice issuer record");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing info was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
+
+                entity.Property(e => e.Phone)
+                    .HasMaxLength(20)
+                    .HasComment("Billing phone with format +XXXXXXXXX");
+
+                entity.Property(e => e.SubjectName)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing Subject name");
+
+                entity.Property(e => e.TaxDate)
+                    .HasColumnType("datetime")
+                    .HasComment("Tax date");
+
+                entity.Property(e => e.TaxNumber)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasComment("Billing Tax number");
+
+                entity.Property(e => e.TotalBaseCurrency)
+                    .IsRequired()
+                    .HasMaxLength(3)
+                    .IsUnicode(false)
+                    .HasComment("Total base price currency (w/o VAT)");
+
+                entity.Property(e => e.TotalBasePrice)
+                    .HasColumnType("decimal(16, 4)")
+                    .HasComment("Total base price (w/o VAT)");
+
+                entity.Property(e => e.Vatnumber)
+                    .HasMaxLength(20)
+                    .HasColumnName("VATNumber")
+                    .HasComment("Billing VAT number");
+
+                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
+
+                entity.Property(e => e.Zip)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasColumnName("ZIP")
+                    .HasComment("Billing Address ZIP");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.InvoiceCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Invoice_User_Created");
+
+                entity.HasOne(d => d.InvoiceIssuer)
+                    .WithMany(p => p.Invoices)
+                    .HasForeignKey(d => d.InvoiceIssuerId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Invoice_InvoiceIssuer");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.InvoiceModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_Invoice_User_Modified");
+
+                entity.HasOne(d => d.Workspace)
+                    .WithMany(p => p.Invoices)
+                    .HasForeignKey(d => d.WorkspaceId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Invoice_Workspace");
+            });
+
+            modelBuilder.Entity<InvoiceIssuer>(entity =>
+            {
+                entity.ToTable("InvoiceIssuer");
+
+                entity.HasComment("Defines information about Invoice Issuer and its contacts information (used in invoice header)");
+
+                entity.Property(e => e.Id).HasComment("Primary key of invoice issuer record");
+
+                entity.Property(e => e.Address1)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing Address line 1");
+
+                entity.Property(e => e.Address2)
+                    .HasMaxLength(200)
+                    .HasComment("Billing Address line 2");
+
+                entity.Property(e => e.City)
+                    .IsRequired()
+                    .HasMaxLength(100)
+                    .HasComment("Billing Address city");
+
+                entity.Property(e => e.Country)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .HasComment("Billing Address country");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing info was created");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
+
+                entity.Property(e => e.Email)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasComment("Billing email");
+
+                entity.Property(e => e.IsEnabled).HasComment("Flag if record is enabled");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing info was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
+
+                entity.Property(e => e.Phone)
+                    .HasMaxLength(20)
+                    .HasComment("Billing phone with format +XXXXXXXXX");
+
+                entity.Property(e => e.SubjectName)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Billing Subject name");
+
+                entity.Property(e => e.TaxNumber)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasComment("Billing Tax number");
+
+                entity.Property(e => e.Vatnumber)
+                    .HasMaxLength(20)
+                    .HasColumnName("VATNumber")
+                    .HasComment("Billing VAT number");
+
+                entity.Property(e => e.Zip)
+                    .IsRequired()
+                    .HasMaxLength(20)
+                    .HasColumnName("ZIP")
+                    .HasComment("Billing Address ZIP");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.InvoiceIssuerCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_InvoiceIssuer_User_Created");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.InvoiceIssuerModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_InvoiceIssuer_User_Modified");
+            });
+
+            modelBuilder.Entity<InvoiceItem>(entity =>
+            {
+                entity.ToTable("InvoiceItem");
+
+                entity.HasComment("Invoice item");
+
+                entity.Property(e => e.Id).HasComment("Primary key of invoice item record");
+
+                entity.Property(e => e.BillingPlanCode)
+                    .IsRequired()
+                    .HasMaxLength(10)
+                    .HasComment("Billing plan short code");
+
+                entity.Property(e => e.BillingPlanId).HasComment("Reference to billing plan");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing info was created");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
+
+                entity.Property(e => e.InvoiceId).HasComment("Reference to owning invoice");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing info was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
+
+                entity.Property(e => e.UnitBaseCurrency)
+                    .IsRequired()
+                    .HasMaxLength(3)
+                    .IsUnicode(false)
+                    .HasComment("Unit base price currency (w/o VAT)");
+
+                entity.Property(e => e.UnitBasePrice)
+                    .HasColumnType("decimal(16, 4)")
+                    .HasComment("Unit base price (w/o VAT)");
+
+                entity.Property(e => e.UnitQuantity)
+                    .HasDefaultValueSql("((1))")
+                    .HasComment("Unit quantity");
+
+                entity.HasOne(d => d.BillingPlan)
+                    .WithMany(p => p.InvoiceItems)
+                    .HasForeignKey(d => d.BillingPlanId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_InvoiceItem_BillingPlan");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.InvoiceItemCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_InvoiceItem_User_Created");
+
+                entity.HasOne(d => d.Invoice)
+                    .WithMany(p => p.InvoiceItems)
+                    .HasForeignKey(d => d.InvoiceId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_InvoiceItem_Invoice");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.InvoiceItemModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_InvoiceItem_User_Modified");
+            });
+
+            modelBuilder.Entity<Metadocument>(entity =>
+            {
+                entity.ToTable("Metadocument");
+
+                entity.HasComment("Abstract single document header to process. Has setting parameters for computing and status");
+
+                entity.Property(e => e.Id).HasComment("Primary key of metadocument record");
+
+                entity.Property(e => e.AffinityRegistrationId).HasComment("Reference to assigned ProcessServer process which currently working on document.");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when metadocument was created (uploaded)");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
+
+                entity.Property(e => e.LastDowloaded)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when metadocument was last downloaded");
+
+                entity.Property(e => e.LastDownloadedByUserId).HasComment("Reference to user who last metadocument dowloaded");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when metadocument was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument");
+
+                entity.Property(e => e.Name)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Metadocument name");
+
+                entity.Property(e => e.Status).HasComment("Metadocument status");
+
+                entity.Property(e => e.StructureId).HasComment("Reference to owning structure (workspace)");
+
+                entity.HasOne(d => d.AffinityRegistration)
+                    .WithMany(p => p.Metadocuments)
+                    .HasForeignKey(d => d.AffinityRegistrationId)
+                    .HasConstraintName("REL_Metadocument_Registration");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.MetadocumentCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Metadocument_User_Created");
+
+                entity.HasOne(d => d.LastDownloadedByUser)
+                    .WithMany(p => p.MetadocumentLastDownloadedByUsers)
+                    .HasForeignKey(d => d.LastDownloadedByUserId)
+                    .HasConstraintName("REL_Metadocument_User_Downloaded");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.MetadocumentModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_Metadocument_User_Modified");
+
+                entity.HasOne(d => d.Structure)
+                    .WithMany(p => p.Metadocuments)
+                    .HasForeignKey(d => d.StructureId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Metadocument_Structure");
+            });
+
+            modelBuilder.Entity<MetadocumentBilling>(entity =>
+            {
+                entity.HasNoKey();
+
+                entity.ToTable("MetadocumentBilling");
+
+                entity.HasComment("Association of metadocument and billing plan with properties. Stores information about processed documents (name, status timestamps, etc.) relates to workspace billing plan selection.");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing was created");
+
+                entity.Property(e => e.CreditCost).HasComment("Numeric value of billing plan spending. Depends on BillingPlan.");
+
+                entity.Property(e => e.Downloaded)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when document was last downloaded");
+
+                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing was modified");
+
+                entity.Property(e => e.Procesed)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when document was processed");
+
+                entity.Property(e => e.ProcessProfile)
+                    .HasMaxLength(5)
+                    .IsUnicode(false)
+                    .HasComment("Processing profile code");
+
+                entity.Property(e => e.ProcessStart)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when document set to processing state");
+
+                entity.Property(e => e.ProcessState).HasComment("Last state of processing (OK,Fail)");
+
+                entity.Property(e => e.Psinstance)
+                    .HasMaxLength(100)
+                    .IsUnicode(false)
+                    .HasColumnName("PSInstance")
+                    .HasComment("Process server instance identifier");
+
+                entity.Property(e => e.Quality).HasComment("Process quality 0 = lowest");
+
+                entity.Property(e => e.Test).HasComment("Flag if testing mode");
+
+                entity.Property(e => e.Watermark).HasComment("Flag if watermarked");
+
+                entity.Property(e => e.WorkspaceBillingId).HasComment("Reference to workspace billing plan");
+
+                entity.HasOne(d => d.Metadocument)
+                    .WithMany()
+                    .HasForeignKey(d => d.MetadocumentId)
+                    .HasConstraintName("REL_MetadocumentBilling_Metadocument");
+
+                entity.HasOne(d => d.WorkspaceBilling)
+                    .WithMany()
+                    .HasForeignKey(d => d.WorkspaceBillingId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_MetadocumentBilling_WorkspaceBilling");
+            });
+
+            modelBuilder.Entity<MetadocumentTag>(entity =>
+            {
+                entity.HasNoKey();
+
+                entity.ToTable("MetadocumentTag");
+
+                entity.HasComment("Association of metadocument and tag");
+
+                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
+
+                entity.Property(e => e.TagId).HasComment("Reference to Tag");
+
+                entity.HasOne(d => d.Metadocument)
+                    .WithMany()
+                    .HasForeignKey(d => d.MetadocumentId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_MetadocumentTag_Metadocument");
+
+                entity.HasOne(d => d.Tag)
+                    .WithMany()
+                    .HasForeignKey(d => d.TagId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_MetadocumentTag_Tag");
+            });
+
+            modelBuilder.Entity<MimeType>(entity =>
+            {
+                entity.ToTable("MimeType");
+
+                entity.HasComment("MIME Types global enumeration. Defines file extension and MIME type association, This table is managed only with administrator.");
+
+                entity.Property(e => e.Id).HasComment("Primary key of MIMEType record");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when metadocument was created (uploaded)");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
+
+                entity.Property(e => e.Description)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Short description of MIMEType");
+
+                entity.Property(e => e.Extensions)
+                    .IsRequired()
+                    .HasMaxLength(500)
+                    .HasComment("Extensions for mime type separated by semicolomn (example cad; cat; txt)");
+
+                entity.Property(e => e.IsEnabled).HasComment("Flag if record is active, otherwise shuld be delete");
+
+                entity.Property(e => e.Mimetype1)
+                    .IsRequired()
+                    .HasMaxLength(500)
+                    .HasColumnName("MIMEType")
+                    .HasComment("MIMEType code");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when metadocument was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated metadocument");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.MimeTypeCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_MimeType_User_Created");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.MimeTypeModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_MimeType_User_Modified");
+            });
+
+            modelBuilder.Entity<Registration>(entity =>
+            {
+                entity.ToTable("Registration");
+
+                entity.HasComment("Holds Process Server registrations");
+
+                entity.Property(e => e.Id).HasComment("Primary key of Registration record");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when registration was created");
+
+                entity.Property(e => e.DocumentFailedCnt).HasComment("# of failed documents");
+
+                entity.Property(e => e.DocumentProcessedCnt).HasComment("# of new processed documents");
+
+                entity.Property(e => e.LastActivity)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp latest activity");
+
+                entity.Property(e => e.LocationIp)
+                    .HasMaxLength(100)
+                    .IsUnicode(false)
+                    .HasColumnName("LocationIP")
+                    .HasComment("Process server instance identifier");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when registration was modified");
+
+                entity.Property(e => e.Psinstance)
+                    .HasMaxLength(100)
+                    .IsUnicode(false)
+                    .HasColumnName("PSInstance")
+                    .HasComment("Process server instance identifier");
+            });
+
+            modelBuilder.Entity<Statistic>(entity =>
+            {
+                entity.ToTable("Statistic");
+
+                entity.HasComment("Holds statistics information on daily base");
+
+                entity.HasIndex(e => new { e.Year, e.Month, e.Day }, "IDX_DATE")
+                    .IsUnique();
+
+                entity.Property(e => e.Id).HasComment("Primary key of Statistic record");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing info was created");
+
+                entity.Property(e => e.Day).HasComment("Day number");
+
+                entity.Property(e => e.DocumentDownloadedCnt).HasComment("# of downloaded documents");
+
+                entity.Property(e => e.DocumentFailedCnt).HasComment("# of failed documents");
+
+                entity.Property(e => e.DocumentNewCnt).HasComment("# of new created/uploaded documents");
+
+                entity.Property(e => e.DocumentProcessedCnt).HasComment("# of processed documents");
+
+                entity.Property(e => e.DocumentTotalCnt).HasComment("# of all available documents");
+
+                entity.Property(e => e.InvoiceNewCnt).HasComment("# of new created invoices");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing info was modified");
+
+                entity.Property(e => e.Month).HasComment("Month number");
+
+                entity.Property(e => e.PsactiveCnt)
+                    .HasColumnName("PSActiveCnt")
+                    .HasComment("# of active ProcessServer instances");
+
+                entity.Property(e => e.UserLoginB2bcnt)
+                    .HasColumnName("UserLoginB2BCnt")
+                    .HasComment("# of logged B2B users");
+
+                entity.Property(e => e.UserLoginCnt).HasComment("# of logged users (incl B2B)");
+
+                entity.Property(e => e.UserNewCnt).HasComment("# of new created users");
+
+                entity.Property(e => e.UserTotalCnt).HasComment("# of all users (incl system)");
+
+                entity.Property(e => e.WorkspaceNewCnt).HasComment("# of new created workspaces");
+
+                entity.Property(e => e.WorkspaceTotalCnt).HasComment("# of all workspaces");
+
+                entity.Property(e => e.Year).HasComment("Year number");
+
+                entity.Property(e => e.YieldWorthCurrency)
+                    .IsRequired()
+                    .HasMaxLength(3)
+                    .IsUnicode(false)
+                    .HasComment("currency code of yieldworth");
+
+                entity.Property(e => e.YieldWorthSum)
+                    .HasColumnType("decimal(16, 4)")
+                    .HasComment("sum of daily yield worth");
+
+                entity.Property(e => e.YieldWorthTotalCurrency)
+                    .IsRequired()
+                    .HasMaxLength(3)
+                    .IsUnicode(false)
+                    .HasComment("currency code of yieldworth");
+
+                entity.Property(e => e.YieldWorthTotalSum)
+                    .HasColumnType("decimal(16, 4)")
+                    .HasComment("sum of daily yield worth");
+            });
+
+            modelBuilder.Entity<StatusHistory>(entity =>
+            {
+                entity.ToTable("StatusHistory");
+
+                entity.HasComment("Stores metadocument status changing log with messages");
+
+                entity.Property(e => e.Id).HasComment("Primary key of metadocument status history record");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when metadocument was created (uploaded)");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created (uploaded) metadocument");
+
+                entity.Property(e => e.Message)
+                    .HasMaxLength(4000)
+                    .HasComment("Status change message or error message. This value is optional.");
+
+                entity.Property(e => e.MetadocumentId).HasComment("Reference to owning metadocument");
+
+                entity.Property(e => e.Status).HasComment("Metadocument status");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.StatusHistories)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_StatusHistory_User_Created");
+
+                entity.HasOne(d => d.Metadocument)
+                    .WithMany(p => p.StatusHistories)
+                    .HasForeignKey(d => d.MetadocumentId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_StatusHistory_Metadocument");
+            });
+
+            modelBuilder.Entity<Structure>(entity =>
+            {
+                entity.ToTable("Structure");
+
+                entity.HasComment("Abstract repository structure (folder-like) where documents are assignig");
+
+                entity.Property(e => e.Id).HasComment("Structure primary key");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when workspace was created");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created workspace");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when workspace was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated workspace");
+
+                entity.Property(e => e.Name)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Structure name");
+
+                entity.Property(e => e.ParentId).HasComment("Reference to parent structure (folder). If null then record is root");
+
+                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
+
+                entity.HasOne(d => d.Parent)
+                    .WithMany(p => p.InverseParent)
+                    .HasForeignKey(d => d.ParentId)
+                    .HasConstraintName("REL_Structure_Structure_Parent");
+
+                entity.HasOne(d => d.Workspace)
+                    .WithMany(p => p.Structures)
+                    .HasForeignKey(d => d.WorkspaceId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Structure_Workspace");
+            });
+
+            modelBuilder.Entity<Tag>(entity =>
+            {
+                entity.ToTable("Tag");
+
+                entity.HasComment("Declares tag for workspace scope. Tag is used on metadocument.");
+
+                entity.Property(e => e.Id).HasComment("Primary key of tag record");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing info was created");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created billing info");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing info was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated billing info");
+
+                entity.Property(e => e.Name)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .HasComment("Tag name");
+
+                entity.Property(e => e.Rgb)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .IsUnicode(false)
+                    .HasColumnName("RGB")
+                    .HasComment("Tag color in RGB format");
+
+                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.TagCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Tag_User_Created");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.TagModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_Tag_User_Modified");
+
+                entity.HasOne(d => d.Workspace)
+                    .WithMany(p => p.Tags)
+                    .HasForeignKey(d => d.WorkspaceId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Tag_Workspace");
+            });
+
+            modelBuilder.Entity<User>(entity =>
+            {
+                entity.ToTable("User");
+
+                entity.HasComment("User identity with properties");
+
+                entity.HasIndex(e => e.Ifreference, "IDX_IFREFERENCE")
+                    .IsUnique();
+
+                entity.HasIndex(e => e.Name, "IDX_USER_NAME")
+                    .IsUnique();
+
+                entity.Property(e => e.Id).HasComment("User primary key");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when user was created");
+
+                entity.Property(e => e.Ifreference)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .IsUnicode(false)
+                    .HasColumnName("IFReference")
+                    .HasComment("Reference to Identity framework IdentityUser.Id");
+
+                entity.Property(e => e.IsEnabled).HasComment("Flag if user can sign on");
+
+                entity.Property(e => e.IsSystem).HasComment("Flag if user is system only account. Cannot log in.");
+
+                entity.Property(e => e.LangLcid)
+                    .HasColumnName("LangLCID")
+                    .HasDefaultValueSql("((1033))")
+                    .HasComment("LCID of preffered user language");
+
+                entity.Property(e => e.LastDisabled)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp of last user set to be disabled");
+
+                entity.Property(e => e.LastEnabled)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp of last user set to be enabled");
+
+                entity.Property(e => e.LastLogged)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp of user last successful login");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when user was modified");
+
+                entity.Property(e => e.Name)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Full user name");
+            });
+
+            modelBuilder.Entity<UserWorkspace>(entity =>
+            {
+                // entity.HasNoKey();
+
+                entity.ToTable("UserWorkspace");
+
+                entity.HasComment("Association between User and Workspace. Which Workspace is assigned to user.");
+
+                entity.Property(e => e.IsDefault).HasComment("Flag if relation is default");
+
+                entity.Property(e => e.UserId).HasComment("Reference to user record");
+
+                entity.Property(e => e.WorkspaceId).HasComment("Reference to workspace record");
+
+                entity.HasOne(d => d.User)
+                    .WithMany()
+                    .HasForeignKey(d => d.UserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_UserWorkspace_User");
+
+                entity.HasOne(d => d.Workspace)
+                    .WithMany()
+                    .HasForeignKey(d => d.WorkspaceId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_UserWorkspace_Workspace");
+            });
+
+            modelBuilder.Entity<Workspace>(entity =>
+            {
+                entity.ToTable("Workspace");
+
+                entity.HasComment("Main workspace root structure holds information about working space (set of documents) and their business plan");
+
+                entity.Property(e => e.Id).HasComment("Workspace primary key");
+
+                entity.Property(e => e.Apikey)
+                    .HasColumnName("APIKey")
+                    .HasDefaultValueSql("(newid())")
+                    .HasComment("API Key for access to workspace via B2B interface");
+
+                entity.Property(e => e.Apipassword)
+                    .IsRequired()
+                    .HasMaxLength(50)
+                    .HasColumnName("APIPassword")
+                    .HasComment("API Key Password for access to workspace via B2B interface");
+
+                entity.Property(e => e.BillingInfoId).HasComment("Reference to current billing info record");
+
+                entity.Property(e => e.BillingPlanId).HasComment("Reference to current billing plan record");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when workspace was created");
+
+                entity.Property(e => e.CreatedByUserId).HasComment("Reference to user who created workspace");
+
+                entity.Property(e => e.IsGold).HasComment("Define if workspace is GOLD mode (has custom billing plan)");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when workspace was modified");
+
+                entity.Property(e => e.ModifiedByUserId).HasComment("Reference to user who updated workspace");
+
+                entity.Property(e => e.Name)
+                    .IsRequired()
+                    .HasMaxLength(200)
+                    .HasComment("Workspace name");
+
+                //entity.HasOne(d => d.BillingInfo)
+                //    .WithMany(p => p.Workspaces)
+                //    .HasForeignKey(d => d.BillingInfoId)
+                //    .HasConstraintName("REL_Workspace_BillingInfo");
+
+                entity.HasOne(d => d.CreatedByUser)
+                    .WithMany(p => p.WorkspaceCreatedByUsers)
+                    .HasForeignKey(d => d.CreatedByUserId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_Workspace_User_Created");
+
+                entity.HasOne(d => d.ModifiedByUser)
+                    .WithMany(p => p.WorkspaceModifiedByUsers)
+                    .HasForeignKey(d => d.ModifiedByUserId)
+                    .HasConstraintName("REL_Workspace_User_Modified");
+            });
+
+            modelBuilder.Entity<WorkspaceBilling>(entity =>
+            {
+                entity.ToTable("WorkspaceBilling");
+
+                entity.HasComment("Deffines current state of billing plan for workspace");
+
+                entity.Property(e => e.Id).HasComment("Primary key of WorkspaceBilling record");
+
+                entity.Property(e => e.BillingPlanId).HasComment("Reference to billing plan");
+
+                entity.Property(e => e.Created)
+                    .HasColumnType("datetime")
+                    .HasDefaultValueSql("(getdate())")
+                    .HasComment("Timestamp when billing was created");
+
+                entity.Property(e => e.CustomPstcreditsPerItem)
+                    .HasColumnName("CustomPSTCreditsPerItem")
+                    .HasComment("Custom Preset Override - single item credit cost");
+
+                entity.Property(e => e.CustomPstinitialCredits)
+                    .HasColumnName("CustomPSTInitialCredits")
+                    .HasComment("Custom Preset Override - initial credit amount");
+
+                entity.Property(e => e.CustomPstprocessProfile)
+                    .HasMaxLength(5)
+                    .IsUnicode(false)
+                    .HasColumnName("CustomPSTProcessProfile")
+                    .HasComment("Custom Preset Override - processing profile code");
+
+                entity.Property(e => e.CustomPstquality)
+                    .HasColumnName("CustomPSTQuality")
+                    .HasComment("Custom Preset Override - process quality 0 = lowest");
+
+                entity.Property(e => e.CustomPsttest)
+                    .HasColumnName("CustomPSTTest")
+                    .HasComment("Custom Preset Override - testing mode");
+
+                entity.Property(e => e.CustomPstwatermark)
+                    .HasColumnName("CustomPSTWatermark")
+                    .HasComment("Custom Preset Override - watermarked");
+
+                entity.Property(e => e.Modified)
+                    .HasColumnType("datetime")
+                    .HasComment("Timestamp when billing was modified");
+
+                entity.Property(e => e.ValueDate)
+                    .HasColumnType("datetime")
+                    .HasComment("DateTime value of billing plan spending. Depends on BillingPlan");
+
+                entity.Property(e => e.ValueNumber)
+                    .HasColumnType("decimal(16, 4)")
+                    .HasComment("Numeric value of billing plan spending. Depends on BillingPlan.");
+
+                entity.Property(e => e.WorkspaceId).HasComment("Reference to owning workspace");
+
+                entity.HasOne(d => d.BillingPlan)
+                    .WithMany(p => p.WorkspaceBillings)
+                    .HasForeignKey(d => d.BillingPlanId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_WorkspaceBilling_BillingPlan");
+
+                entity.HasOne(d => d.Workspace)
+                    .WithMany(p => p.WorkspaceBillings)
+                    .HasForeignKey(d => d.WorkspaceId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_WorkspaceBilling_Workspace");
+            });
+
+            OnModelCreatingPartial(modelBuilder);
+        }
+
+        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+    }
+}

+ 37 - 37
AppServer/Data/Entity/BillingInfo.cs

@@ -1,37 +1,37 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class BillingInfo
-    {
-        public BillingInfo()
-        {
-            Workspaces = new HashSet<Workspace>();
-        }
-
-        // public long Id { get; set; }
-        public long WorkspaceId { get; set; }
-        public string SubjectName { get; set; }
-        public string Address1 { get; set; }
-        public string Address2 { get; set; }
-        public string City { get; set; }
-        public string Zip { get; set; }
-        public string Country { get; set; }
-        public string TaxNumber { get; set; }
-        public string Vatnumber { get; set; }
-        public string Phone { get; set; }
-        public string Email { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual Workspace Workspace { get; set; }
-        public virtual ICollection<Workspace> Workspaces { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class BillingInfo
+    {
+        public BillingInfo()
+        {
+            Workspaces = new HashSet<Workspace>();
+        }
+
+        // public long Id { get; set; }
+        public long WorkspaceId { get; set; }
+        public string SubjectName { get; set; }
+        public string Address1 { get; set; }
+        public string Address2 { get; set; }
+        public string City { get; set; }
+        public string Zip { get; set; }
+        public string Country { get; set; }
+        public string TaxNumber { get; set; }
+        public string Vatnumber { get; set; }
+        public string Phone { get; set; }
+        public string Email { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual Workspace Workspace { get; set; }
+        public virtual ICollection<Workspace> Workspaces { get; set; }
+    }
+}

+ 41 - 41
AppServer/Data/Entity/BillingPlan.cs

@@ -1,41 +1,41 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class BillingPlan
-    {
-        public BillingPlan()
-        {
-            InvoiceItems = new HashSet<InvoiceItem>();
-            WorkspaceBillings = new HashSet<WorkspaceBilling>();
-        }
-
-        // public long Id { get; set; }
-        public string Name { get; set; }
-        public string Code { get; set; }
-        public string Description { get; set; }
-        public int PstinitialCredits { get; set; }
-        public int PstcreditsPerItem { get; set; }
-        public bool Pstwatermark { get; set; }
-        public int Pstquality { get; set; }
-        public string PstprocessProfile { get; set; }
-        public bool Psttest { get; set; }
-        public decimal Price { get; set; }
-        public string Currency { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-        public bool IsCustom { get; set; }
-        public bool IsHidden { get; set; }
-        public bool IsEnabled { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual ICollection<InvoiceItem> InvoiceItems { get; set; }
-        public virtual ICollection<WorkspaceBilling> WorkspaceBillings { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class BillingPlan
+    {
+        public BillingPlan()
+        {
+            InvoiceItems = new HashSet<InvoiceItem>();
+            WorkspaceBillings = new HashSet<WorkspaceBilling>();
+        }
+
+        // public long Id { get; set; }
+        public string Name { get; set; }
+        public string Code { get; set; }
+        public string Description { get; set; }
+        public int PstinitialCredits { get; set; }
+        public int PstcreditsPerItem { get; set; }
+        public bool Pstwatermark { get; set; }
+        public int Pstquality { get; set; }
+        public string PstprocessProfile { get; set; }
+        public bool Psttest { get; set; }
+        public decimal Price { get; set; }
+        public string Currency { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+        public bool IsCustom { get; set; }
+        public bool IsHidden { get; set; }
+        public bool IsEnabled { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual ICollection<InvoiceItem> InvoiceItems { get; set; }
+        public virtual ICollection<WorkspaceBilling> WorkspaceBillings { get; set; }
+    }
+}

+ 46 - 46
AppServer/Data/Entity/Invoice.cs

@@ -1,46 +1,46 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Invoice
-    {
-        public Invoice()
-        {
-            InvoiceItems = new HashSet<InvoiceItem>();
-        }
-
-        // public long Id { get; set; }
-        public long WorkspaceId { get; set; }
-        public long InvoiceIssuerId { get; set; }
-        public string Code { get; set; }
-        public string SubjectName { get; set; }
-        public string Address1 { get; set; }
-        public string Address2 { get; set; }
-        public string City { get; set; }
-        public string Zip { get; set; }
-        public string Country { get; set; }
-        public string TaxNumber { get; set; }
-        public string Vatnumber { get; set; }
-        public string Phone { get; set; }
-        public string Email { get; set; }
-        public decimal TotalBasePrice { get; set; }
-        public string TotalBaseCurrency { get; set; }
-        public string Channel { get; set; }
-        public string ChannelReference { get; set; }
-        public DateTime DueDate { get; set; }
-        public DateTime TaxDate { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual InvoiceIssuer InvoiceIssuer { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual Workspace Workspace { get; set; }
-        public virtual ICollection<InvoiceItem> InvoiceItems { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Invoice
+    {
+        public Invoice()
+        {
+            InvoiceItems = new HashSet<InvoiceItem>();
+        }
+
+        // public long Id { get; set; }
+        public long WorkspaceId { get; set; }
+        public long InvoiceIssuerId { get; set; }
+        public string Code { get; set; }
+        public string SubjectName { get; set; }
+        public string Address1 { get; set; }
+        public string Address2 { get; set; }
+        public string City { get; set; }
+        public string Zip { get; set; }
+        public string Country { get; set; }
+        public string TaxNumber { get; set; }
+        public string Vatnumber { get; set; }
+        public string Phone { get; set; }
+        public string Email { get; set; }
+        public decimal TotalBasePrice { get; set; }
+        public string TotalBaseCurrency { get; set; }
+        public string Channel { get; set; }
+        public string ChannelReference { get; set; }
+        public DateTime DueDate { get; set; }
+        public DateTime TaxDate { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual InvoiceIssuer InvoiceIssuer { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual Workspace Workspace { get; set; }
+        public virtual ICollection<InvoiceItem> InvoiceItems { get; set; }
+    }
+}

+ 36 - 36
AppServer/Data/Entity/InvoiceIssuer.cs

@@ -1,36 +1,36 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class InvoiceIssuer
-    {
-        public InvoiceIssuer()
-        {
-            Invoices = new HashSet<Invoice>();
-        }
-
-        // public long Id { get; set; }
-        public string SubjectName { get; set; }
-        public string Address1 { get; set; }
-        public string Address2 { get; set; }
-        public string City { get; set; }
-        public string Zip { get; set; }
-        public string Country { get; set; }
-        public string TaxNumber { get; set; }
-        public string Vatnumber { get; set; }
-        public string Phone { get; set; }
-        public string Email { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-        public bool IsEnabled { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual ICollection<Invoice> Invoices { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class InvoiceIssuer
+    {
+        public InvoiceIssuer()
+        {
+            Invoices = new HashSet<Invoice>();
+        }
+
+        // public long Id { get; set; }
+        public string SubjectName { get; set; }
+        public string Address1 { get; set; }
+        public string Address2 { get; set; }
+        public string City { get; set; }
+        public string Zip { get; set; }
+        public string Country { get; set; }
+        public string TaxNumber { get; set; }
+        public string Vatnumber { get; set; }
+        public string Phone { get; set; }
+        public string Email { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+        public bool IsEnabled { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual ICollection<Invoice> Invoices { get; set; }
+    }
+}

+ 27 - 27
AppServer/Data/Entity/InvoiceItem.cs

@@ -1,27 +1,27 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class InvoiceItem
-    {
-        // public long Id { get; set; }
-        public long InvoiceId { get; set; }
-        public long BillingPlanId { get; set; }
-        public string BillingPlanCode { get; set; }
-        public int UnitQuantity { get; set; }
-        public decimal UnitBasePrice { get; set; }
-        public string UnitBaseCurrency { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-
-        public virtual BillingPlan BillingPlan { get; set; }
-        public virtual User CreatedByUser { get; set; }
-        public virtual Invoice Invoice { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class InvoiceItem
+    {
+        // public long Id { get; set; }
+        public long InvoiceId { get; set; }
+        public long BillingPlanId { get; set; }
+        public string BillingPlanCode { get; set; }
+        public int UnitQuantity { get; set; }
+        public decimal UnitBasePrice { get; set; }
+        public string UnitBaseCurrency { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+
+        public virtual BillingPlan BillingPlan { get; set; }
+        public virtual User CreatedByUser { get; set; }
+        public virtual Invoice Invoice { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+    }
+}

+ 36 - 34
AppServer/Data/Entity/Metadocument.cs

@@ -1,34 +1,36 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Metadocument
-    {
-        public Metadocument()
-        {
-            Artifacts = new HashSet<Artifact>();
-            StatusHistories = new HashSet<StatusHistory>();
-        }
-
-        // public long Id { get; set; }
-        public long StructureId { get; set; }
-        public string Name { get; set; }
-        public int Status { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public DateTime? LastDowloaded { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-        public long? LastDownloadedByUserId { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual User LastDownloadedByUser { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual Structure Structure { get; set; }
-        public virtual ICollection<Artifact> Artifacts { get; set; }
-        public virtual ICollection<StatusHistory> StatusHistories { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Metadocument
+    {
+        public Metadocument()
+        {
+            Artifacts = new HashSet<Artifact>();
+            StatusHistories = new HashSet<StatusHistory>();
+        }
+
+        // public long Id { get; set; }
+        public long StructureId { get; set; }
+        public long? AffinityRegistrationId { get; set; }
+        public string Name { get; set; }
+        public int Status { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public DateTime? LastDowloaded { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+        public long? LastDownloadedByUserId { get; set; }
+
+        public virtual Registration AffinityRegistration { get; set; }
+        public virtual User CreatedByUser { get; set; }
+        public virtual User LastDownloadedByUser { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual Structure Structure { get; set; }
+        public virtual ICollection<Artifact> Artifacts { get; set; }
+        public virtual ICollection<StatusHistory> StatusHistories { get; set; }
+    }
+}

+ 28 - 28
AppServer/Data/Entity/MetadocumentBilling.cs

@@ -1,28 +1,28 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class MetadocumentBilling
-    {
-        public long? MetadocumentId { get; set; }
-        public long WorkspaceBillingId { get; set; }
-        public int CreditCost { get; set; }
-        public bool Watermark { get; set; }
-        public int Quality { get; set; }
-        public string ProcessProfile { get; set; }
-        public bool Test { get; set; }
-        public DateTime? Procesed { get; set; }
-        public DateTime? ProcessStart { get; set; }
-        public DateTime? Downloaded { get; set; }
-        public int ProcessState { get; set; }
-        public string Psinstance { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-
-        public virtual Metadocument Metadocument { get; set; }
-        public virtual WorkspaceBilling WorkspaceBilling { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class MetadocumentBilling
+    {
+        public long? MetadocumentId { get; set; }
+        public long WorkspaceBillingId { get; set; }
+        public int CreditCost { get; set; }
+        public bool Watermark { get; set; }
+        public int Quality { get; set; }
+        public string ProcessProfile { get; set; }
+        public bool Test { get; set; }
+        public DateTime? Procesed { get; set; }
+        public DateTime? ProcessStart { get; set; }
+        public DateTime? Downloaded { get; set; }
+        public int ProcessState { get; set; }
+        public string Psinstance { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+
+        public virtual Metadocument Metadocument { get; set; }
+        public virtual WorkspaceBilling WorkspaceBilling { get; set; }
+    }
+}

+ 16 - 16
AppServer/Data/Entity/MetadocumentTag.cs

@@ -1,16 +1,16 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class MetadocumentTag
-    {
-        public long MetadocumentId { get; set; }
-        public long TagId { get; set; }
-
-        public virtual Metadocument Metadocument { get; set; }
-        public virtual Tag Tag { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class MetadocumentTag
+    {
+        public long MetadocumentId { get; set; }
+        public long TagId { get; set; }
+
+        public virtual Metadocument Metadocument { get; set; }
+        public virtual Tag Tag { get; set; }
+    }
+}

+ 29 - 29
AppServer/Data/Entity/MimeType.cs

@@ -1,29 +1,29 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class MimeType
-    {
-        public MimeType()
-        {
-            Artifacts = new HashSet<Artifact>();
-        }
-
-        // public long Id { get; set; }
-        public string Mimetype1 { get; set; }
-        public string Extensions { get; set; }
-        public string Description { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-        public bool IsEnabled { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual ICollection<Artifact> Artifacts { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class MimeType
+    {
+        public MimeType()
+        {
+            Artifacts = new HashSet<Artifact>();
+        }
+
+        // public long Id { get; set; }
+        public string Mimetype1 { get; set; }
+        public string Extensions { get; set; }
+        public string Description { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+        public bool IsEnabled { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual ICollection<Artifact> Artifacts { get; set; }
+    }
+}

+ 26 - 19
AppServer/Data/Entity/Registration.cs

@@ -1,19 +1,26 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Registration
-    {
-        // public long Id { get; set; }
-        public string Psinstance { get; set; }
-        public string LocationIp { get; set; }
-        public DateTime? LastActivity { get; set; }
-        public int DocumentProcessedCnt { get; set; }
-        public int DocumentFailedCnt { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Registration
+    {
+        public Registration()
+        {
+            Metadocuments = new HashSet<Metadocument>();
+        }
+
+        // public long Id { get; set; }
+        public string Psinstance { get; set; }
+        public string LocationIp { get; set; }
+        public DateTime? LastActivity { get; set; }
+        public int DocumentProcessedCnt { get; set; }
+        public int DocumentFailedCnt { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+
+        public virtual ICollection<Metadocument> Metadocuments { get; set; }
+    }
+}

+ 34 - 34
AppServer/Data/Entity/Statistic.cs

@@ -1,34 +1,34 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Statistic
-    {
-        // public long Id { get; set; }
-        public int Year { get; set; }
-        public int Month { get; set; }
-        public int Day { get; set; }
-        public int UserNewCnt { get; set; }
-        public int UserLoginCnt { get; set; }
-        public int UserLoginB2bcnt { get; set; }
-        public int UserTotalCnt { get; set; }
-        public int WorkspaceNewCnt { get; set; }
-        public int WorkspaceTotalCnt { get; set; }
-        public int InvoiceNewCnt { get; set; }
-        public int DocumentNewCnt { get; set; }
-        public int DocumentFailedCnt { get; set; }
-        public int DocumentDownloadedCnt { get; set; }
-        public int DocumentTotalCnt { get; set; }
-        public int DocumentProcessedCnt { get; set; }
-        public int PsactiveCnt { get; set; }
-        public decimal YieldWorthSum { get; set; }
-        public string YieldWorthCurrency { get; set; }
-        public decimal YieldWorthTotalSum { get; set; }
-        public string YieldWorthTotalCurrency { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Statistic
+    {
+        // public long Id { get; set; }
+        public int Year { get; set; }
+        public int Month { get; set; }
+        public int Day { get; set; }
+        public int UserNewCnt { get; set; }
+        public int UserLoginCnt { get; set; }
+        public int UserLoginB2bcnt { get; set; }
+        public int UserTotalCnt { get; set; }
+        public int WorkspaceNewCnt { get; set; }
+        public int WorkspaceTotalCnt { get; set; }
+        public int InvoiceNewCnt { get; set; }
+        public int DocumentNewCnt { get; set; }
+        public int DocumentFailedCnt { get; set; }
+        public int DocumentDownloadedCnt { get; set; }
+        public int DocumentTotalCnt { get; set; }
+        public int DocumentProcessedCnt { get; set; }
+        public int PsactiveCnt { get; set; }
+        public decimal YieldWorthSum { get; set; }
+        public string YieldWorthCurrency { get; set; }
+        public decimal YieldWorthTotalSum { get; set; }
+        public string YieldWorthTotalCurrency { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+    }
+}

+ 20 - 20
AppServer/Data/Entity/StatusHistory.cs

@@ -1,20 +1,20 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class StatusHistory
-    {
-        // public long Id { get; set; }
-        public long MetadocumentId { get; set; }
-        public int Status { get; set; }
-        public string Message { get; set; }
-        public DateTime Created { get; set; }
-        public long CreatedByUserId { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual Metadocument Metadocument { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class StatusHistory
+    {
+        // public long Id { get; set; }
+        public long MetadocumentId { get; set; }
+        public int Status { get; set; }
+        public string Message { get; set; }
+        public DateTime Created { get; set; }
+        public long CreatedByUserId { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual Metadocument Metadocument { get; set; }
+    }
+}

+ 30 - 30
AppServer/Data/Entity/Structure.cs

@@ -1,30 +1,30 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Structure
-    {
-        public Structure()
-        {
-            InverseParent = new HashSet<Structure>();
-            Metadocuments = new HashSet<Metadocument>();
-        }
-
-        // public long Id { get; set; }
-        public string Name { get; set; }
-        public long WorkspaceId { get; set; }
-        public long? ParentId { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-
-        public virtual Structure Parent { get; set; }
-        public virtual Workspace Workspace { get; set; }
-        public virtual ICollection<Structure> InverseParent { get; set; }
-        public virtual ICollection<Metadocument> Metadocuments { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Structure
+    {
+        public Structure()
+        {
+            InverseParent = new HashSet<Structure>();
+            Metadocuments = new HashSet<Metadocument>();
+        }
+
+        // public long Id { get; set; }
+        public string Name { get; set; }
+        public long WorkspaceId { get; set; }
+        public long? ParentId { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+
+        public virtual Structure Parent { get; set; }
+        public virtual Workspace Workspace { get; set; }
+        public virtual ICollection<Structure> InverseParent { get; set; }
+        public virtual ICollection<Metadocument> Metadocuments { get; set; }
+    }
+}

+ 23 - 23
AppServer/Data/Entity/Tag.cs

@@ -1,23 +1,23 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Tag
-    {
-        // public long Id { get; set; }
-        public long WorkspaceId { get; set; }
-        public string Name { get; set; }
-        public string Rgb { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-
-        public virtual User CreatedByUser { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual Workspace Workspace { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Tag
+    {
+        // public long Id { get; set; }
+        public long WorkspaceId { get; set; }
+        public string Name { get; set; }
+        public string Rgb { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+
+        public virtual User CreatedByUser { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual Workspace Workspace { get; set; }
+    }
+}

+ 69 - 69
AppServer/Data/Entity/User.cs

@@ -1,69 +1,69 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class User
-    {
-        public User()
-        {
-            Artifacts = new HashSet<Artifact>();
-            BillingInfoCreatedByUsers = new HashSet<BillingInfo>();
-            BillingInfoModifiedByUsers = new HashSet<BillingInfo>();
-            BillingPlanCreatedByUsers = new HashSet<BillingPlan>();
-            BillingPlanModifiedByUsers = new HashSet<BillingPlan>();
-            InvoiceCreatedByUsers = new HashSet<Invoice>();
-            InvoiceIssuerCreatedByUsers = new HashSet<InvoiceIssuer>();
-            InvoiceIssuerModifiedByUsers = new HashSet<InvoiceIssuer>();
-            InvoiceItemCreatedByUsers = new HashSet<InvoiceItem>();
-            InvoiceItemModifiedByUsers = new HashSet<InvoiceItem>();
-            InvoiceModifiedByUsers = new HashSet<Invoice>();
-            MetadocumentCreatedByUsers = new HashSet<Metadocument>();
-            MetadocumentLastDownloadedByUsers = new HashSet<Metadocument>();
-            MetadocumentModifiedByUsers = new HashSet<Metadocument>();
-            MimeTypeCreatedByUsers = new HashSet<MimeType>();
-            MimeTypeModifiedByUsers = new HashSet<MimeType>();
-            StatusHistories = new HashSet<StatusHistory>();
-            TagCreatedByUsers = new HashSet<Tag>();
-            TagModifiedByUsers = new HashSet<Tag>();
-            WorkspaceCreatedByUsers = new HashSet<Workspace>();
-            WorkspaceModifiedByUsers = new HashSet<Workspace>();
-        }
-
-        // public long Id { get; set; }
-        public string Ifreference { get; set; }
-        public string Name { get; set; }
-        public DateTime? LastLogged { get; set; }
-        public DateTime? LastDisabled { get; set; }
-        public DateTime? LastEnabled { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public int LangLcid { get; set; }
-        public bool IsSystem { get; set; }
-        public bool IsEnabled { get; set; }
-
-        public virtual ICollection<Artifact> Artifacts { get; set; }
-        public virtual ICollection<BillingInfo> BillingInfoCreatedByUsers { get; set; }
-        public virtual ICollection<BillingInfo> BillingInfoModifiedByUsers { get; set; }
-        public virtual ICollection<BillingPlan> BillingPlanCreatedByUsers { get; set; }
-        public virtual ICollection<BillingPlan> BillingPlanModifiedByUsers { get; set; }
-        public virtual ICollection<Invoice> InvoiceCreatedByUsers { get; set; }
-        public virtual ICollection<InvoiceIssuer> InvoiceIssuerCreatedByUsers { get; set; }
-        public virtual ICollection<InvoiceIssuer> InvoiceIssuerModifiedByUsers { get; set; }
-        public virtual ICollection<InvoiceItem> InvoiceItemCreatedByUsers { get; set; }
-        public virtual ICollection<InvoiceItem> InvoiceItemModifiedByUsers { get; set; }
-        public virtual ICollection<Invoice> InvoiceModifiedByUsers { get; set; }
-        public virtual ICollection<Metadocument> MetadocumentCreatedByUsers { get; set; }
-        public virtual ICollection<Metadocument> MetadocumentLastDownloadedByUsers { get; set; }
-        public virtual ICollection<Metadocument> MetadocumentModifiedByUsers { get; set; }
-        public virtual ICollection<MimeType> MimeTypeCreatedByUsers { get; set; }
-        public virtual ICollection<MimeType> MimeTypeModifiedByUsers { get; set; }
-        public virtual ICollection<StatusHistory> StatusHistories { get; set; }
-        public virtual ICollection<Tag> TagCreatedByUsers { get; set; }
-        public virtual ICollection<Tag> TagModifiedByUsers { get; set; }
-        public virtual ICollection<Workspace> WorkspaceCreatedByUsers { get; set; }
-        public virtual ICollection<Workspace> WorkspaceModifiedByUsers { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class User
+    {
+        public User()
+        {
+            Artifacts = new HashSet<Artifact>();
+            BillingInfoCreatedByUsers = new HashSet<BillingInfo>();
+            BillingInfoModifiedByUsers = new HashSet<BillingInfo>();
+            BillingPlanCreatedByUsers = new HashSet<BillingPlan>();
+            BillingPlanModifiedByUsers = new HashSet<BillingPlan>();
+            InvoiceCreatedByUsers = new HashSet<Invoice>();
+            InvoiceIssuerCreatedByUsers = new HashSet<InvoiceIssuer>();
+            InvoiceIssuerModifiedByUsers = new HashSet<InvoiceIssuer>();
+            InvoiceItemCreatedByUsers = new HashSet<InvoiceItem>();
+            InvoiceItemModifiedByUsers = new HashSet<InvoiceItem>();
+            InvoiceModifiedByUsers = new HashSet<Invoice>();
+            MetadocumentCreatedByUsers = new HashSet<Metadocument>();
+            MetadocumentLastDownloadedByUsers = new HashSet<Metadocument>();
+            MetadocumentModifiedByUsers = new HashSet<Metadocument>();
+            MimeTypeCreatedByUsers = new HashSet<MimeType>();
+            MimeTypeModifiedByUsers = new HashSet<MimeType>();
+            StatusHistories = new HashSet<StatusHistory>();
+            TagCreatedByUsers = new HashSet<Tag>();
+            TagModifiedByUsers = new HashSet<Tag>();
+            WorkspaceCreatedByUsers = new HashSet<Workspace>();
+            WorkspaceModifiedByUsers = new HashSet<Workspace>();
+        }
+
+        // public long Id { get; set; }
+        public string Ifreference { get; set; }
+        public string Name { get; set; }
+        public DateTime? LastLogged { get; set; }
+        public DateTime? LastDisabled { get; set; }
+        public DateTime? LastEnabled { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public int LangLcid { get; set; }
+        public bool IsSystem { get; set; }
+        public bool IsEnabled { get; set; }
+
+        public virtual ICollection<Artifact> Artifacts { get; set; }
+        public virtual ICollection<BillingInfo> BillingInfoCreatedByUsers { get; set; }
+        public virtual ICollection<BillingInfo> BillingInfoModifiedByUsers { get; set; }
+        public virtual ICollection<BillingPlan> BillingPlanCreatedByUsers { get; set; }
+        public virtual ICollection<BillingPlan> BillingPlanModifiedByUsers { get; set; }
+        public virtual ICollection<Invoice> InvoiceCreatedByUsers { get; set; }
+        public virtual ICollection<InvoiceIssuer> InvoiceIssuerCreatedByUsers { get; set; }
+        public virtual ICollection<InvoiceIssuer> InvoiceIssuerModifiedByUsers { get; set; }
+        public virtual ICollection<InvoiceItem> InvoiceItemCreatedByUsers { get; set; }
+        public virtual ICollection<InvoiceItem> InvoiceItemModifiedByUsers { get; set; }
+        public virtual ICollection<Invoice> InvoiceModifiedByUsers { get; set; }
+        public virtual ICollection<Metadocument> MetadocumentCreatedByUsers { get; set; }
+        public virtual ICollection<Metadocument> MetadocumentLastDownloadedByUsers { get; set; }
+        public virtual ICollection<Metadocument> MetadocumentModifiedByUsers { get; set; }
+        public virtual ICollection<MimeType> MimeTypeCreatedByUsers { get; set; }
+        public virtual ICollection<MimeType> MimeTypeModifiedByUsers { get; set; }
+        public virtual ICollection<StatusHistory> StatusHistories { get; set; }
+        public virtual ICollection<Tag> TagCreatedByUsers { get; set; }
+        public virtual ICollection<Tag> TagModifiedByUsers { get; set; }
+        public virtual ICollection<Workspace> WorkspaceCreatedByUsers { get; set; }
+        public virtual ICollection<Workspace> WorkspaceModifiedByUsers { get; set; }
+    }
+}

+ 17 - 17
AppServer/Data/Entity/UserWorkspace.cs

@@ -1,17 +1,17 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class UserWorkspace
-    {
-        public long UserId { get; set; }
-        public long WorkspaceId { get; set; }
-        public bool IsDefault { get; set; }
-
-        public virtual User User { get; set; }
-        public virtual Workspace Workspace { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class UserWorkspace
+    {
+        public long UserId { get; set; }
+        public long WorkspaceId { get; set; }
+        public bool IsDefault { get; set; }
+
+        public virtual User User { get; set; }
+        public virtual Workspace Workspace { get; set; }
+    }
+}

+ 40 - 40
AppServer/Data/Entity/Workspace.cs

@@ -1,40 +1,40 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class Workspace
-    {
-        public Workspace()
-        {
-            BillingInfos = new HashSet<BillingInfo>();
-            Invoices = new HashSet<Invoice>();
-            Structures = new HashSet<Structure>();
-            Tags = new HashSet<Tag>();
-            WorkspaceBillings = new HashSet<WorkspaceBilling>();
-        }
-
-        // public long Id { get; set; }
-        public string Name { get; set; }
-        public long? BillingInfoId { get; set; }
-        public long BillingPlanId { get; set; }
-        public Guid Apikey { get; set; }
-        public string Apipassword { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public long CreatedByUserId { get; set; }
-        public long? ModifiedByUserId { get; set; }
-        public bool IsGold { get; set; }
-
-        public virtual BillingInfo BillingInfo { get; set; }
-        public virtual User CreatedByUser { get; set; }
-        public virtual User ModifiedByUser { get; set; }
-        public virtual ICollection<BillingInfo> BillingInfos { get; set; }
-        public virtual ICollection<Invoice> Invoices { get; set; }
-        public virtual ICollection<Structure> Structures { get; set; }
-        public virtual ICollection<Tag> Tags { get; set; }
-        public virtual ICollection<WorkspaceBilling> WorkspaceBillings { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class Workspace
+    {
+        public Workspace()
+        {
+            BillingInfos = new HashSet<BillingInfo>();
+            Invoices = new HashSet<Invoice>();
+            Structures = new HashSet<Structure>();
+            Tags = new HashSet<Tag>();
+            WorkspaceBillings = new HashSet<WorkspaceBilling>();
+        }
+
+        // public long Id { get; set; }
+        public string Name { get; set; }
+        public long? BillingInfoId { get; set; }
+        public long BillingPlanId { get; set; }
+        public Guid Apikey { get; set; }
+        public string Apipassword { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public long CreatedByUserId { get; set; }
+        public long? ModifiedByUserId { get; set; }
+        public bool IsGold { get; set; }
+
+        public virtual BillingInfo BillingInfo { get; set; }
+        public virtual User CreatedByUser { get; set; }
+        public virtual User ModifiedByUser { get; set; }
+        public virtual ICollection<BillingInfo> BillingInfos { get; set; }
+        public virtual ICollection<Invoice> Invoices { get; set; }
+        public virtual ICollection<Structure> Structures { get; set; }
+        public virtual ICollection<Tag> Tags { get; set; }
+        public virtual ICollection<WorkspaceBilling> WorkspaceBillings { get; set; }
+    }
+}

+ 27 - 27
AppServer/Data/Entity/WorkspaceBilling.cs

@@ -1,27 +1,27 @@
-using System;
-using System.Collections.Generic;
-
-#nullable disable
-
-namespace BO.AppServer.Data.Entity
-{
-    public partial class WorkspaceBilling
-    {
-        // public long Id { get; set; }
-        public long WorkspaceId { get; set; }
-        public long BillingPlanId { get; set; }
-        public DateTime Created { get; set; }
-        public DateTime? Modified { get; set; }
-        public decimal ValueNumber { get; set; }
-        public DateTime? ValueDate { get; set; }
-        public int CustomPstinitialCredits { get; set; }
-        public int CustomPstcreditsPerItem { get; set; }
-        public bool CustomPstwatermark { get; set; }
-        public int CustomPstquality { get; set; }
-        public string CustomPstprocessProfile { get; set; }
-        public bool CustomPsttest { get; set; }
-
-        public virtual BillingPlan BillingPlan { get; set; }
-        public virtual Workspace Workspace { get; set; }
-    }
-}
+using System;
+using System.Collections.Generic;
+
+#nullable disable
+
+namespace BO.AppServer.Data.Entity
+{
+    public partial class WorkspaceBilling
+    {
+        // public long Id { get; set; }
+        public long WorkspaceId { get; set; }
+        public long BillingPlanId { get; set; }
+        public DateTime Created { get; set; }
+        public DateTime? Modified { get; set; }
+        public decimal ValueNumber { get; set; }
+        public DateTime? ValueDate { get; set; }
+        public int CustomPstinitialCredits { get; set; }
+        public int CustomPstcreditsPerItem { get; set; }
+        public bool CustomPstwatermark { get; set; }
+        public int CustomPstquality { get; set; }
+        public string CustomPstprocessProfile { get; set; }
+        public bool CustomPsttest { get; set; }
+
+        public virtual BillingPlan BillingPlan { get; set; }
+        public virtual Workspace Workspace { get; set; }
+    }
+}

+ 18 - 3
AppServer/Data/readme.txt

@@ -4,10 +4,25 @@ To reverse update:
 - Set Data project as Startup Project
 - Ensure if solution is buildable - backup Entity folder
 - Open PM (Package Manager Console from View menu)
-- Run following command
-Scaffold-DbContext "Server=(local);Database=BO;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Entity -Force
+- Run following command (in case localdb use (localdb)\\MSSQLLocalDB)
+Scaffold-DbContext "Server=use (localdb)\\MSSQLLocalDB;Database=BO;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Entity -Force
 - Go to file BOContext.cs and replace class declaration as : public partial class BOContext : DataDomain
-- replace in all entities // // // public long Id { get; set; } -> // // // // public long Id { get; set; }
+- Delete constructor BoContext()
+- replace in all entities // public long Id { get; set; } -> // // public long Id { get; set; }
+- replace in BOContext.cs occurency [ln cca:173]:
+ entity.HasOne(d => d.Workspace)
+                    .WithMany(p => p.BillingInfos)
+                    .HasForeignKey(d => d.WorkspaceId)
+                    .OnDelete(DeleteBehavior.ClientSetNull)
+                    .HasConstraintName("REL_BillingInfo_Workspace");
+to:
+
+ //entity.HasOne(d => d.Workspace)
+                //    .WithMany(p => p.BillingInfos)
+                //    .HasForeignKey(d => d.WorkspaceId)
+                //    .OnDelete(DeleteBehavior.ClientSetNull)
+                //    .HasConstraintName("REL_BillingInfo_Workspace");
+
 - replace in BOContext.cs occurency [ln cca:1069]:
 modelBuilder.Entity<UserWorkspace>(entity =>
             {

+ 1 - 1
Console/Commands/Install/InstallDbCommand.cs

@@ -19,7 +19,7 @@ namespace BO.Console.Commands.Install
     {
         #region *** Constants ***
 
-        private const string DB_VERSION = "1.0.9";
+        private const string DB_VERSION = "1.0.10";
         private const string DB_PROP_NAME = "BO_Version";
 
 

+ 9 - 3
Console/Scripts/bo_create_schema.sql

@@ -1,4 +1,4 @@
--- 19.10.2021 1.0.9
+-- 19.10.2021 1.0.10
 -- Table User --------------------------
 --Defines User identity with statistics informations. Defines if user is enabled and/or user is system account also.
 CREATE TABLE [dbo].[User]
@@ -269,6 +269,7 @@ CREATE TABLE [dbo].[Metadocument]
 (
     [Id] [bigint] NOT NULL IDENTITY (1, 1),
     [StructureId] [bigint] NOT NULL,
+    [AffinityRegistrationId] [bigint] NULL,
     [Name] [nvarchar] (200) NOT NULL,
     [Status] [int] NOT NULL CONSTRAINT DF_Metadocument_Status DEFAULT 0,
     [Created] [datetime] NOT NULL CONSTRAINT DF_Metadocument_Created DEFAULT getdate(),
@@ -287,6 +288,9 @@ GO
 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Reference to owning structure (workspace)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Metadocument', @level2type=N'COLUMN',@level2name=N'StructureId'
 GO
 
+EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Reference to assigned ProcessServer process which currently working on document.' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Metadocument', @level2type=N'COLUMN',@level2name=N'AffinityRegistrationId'
+GO
+
 EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Metadocument name' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Metadocument', @level2type=N'COLUMN',@level2name=N'Name'
 GO
 
@@ -1156,7 +1160,8 @@ ADD
     CONSTRAINT REL_Metadocument_Structure FOREIGN KEY (StructureId) REFERENCES [dbo].[Structure] (Id), 
     CONSTRAINT REL_Metadocument_User_Created FOREIGN KEY (CreatedByUserId) REFERENCES [dbo].[User] (Id), 
     CONSTRAINT REL_Metadocument_User_Modified FOREIGN KEY (ModifiedByUserId) REFERENCES [dbo].[User] (Id), 
-    CONSTRAINT REL_Metadocument_User_Downloaded FOREIGN KEY (LastDownloadedByUserId) REFERENCES [dbo].[User] (Id)
+    CONSTRAINT REL_Metadocument_User_Downloaded FOREIGN KEY (LastDownloadedByUserId) REFERENCES [dbo].[User] (Id), 
+    CONSTRAINT REL_Metadocument_Registration FOREIGN KEY (AffinityRegistrationId) REFERENCES [dbo].[Registration] (Id)
 GO
 
 -- References for StatusHistory --------------------------
@@ -1240,4 +1245,5 @@ ALTER TABLE [dbo].[InvoiceIssuer]
 ADD 
     CONSTRAINT REL_InvoiceIssuer_User_Created FOREIGN KEY (CreatedByUserId) REFERENCES [dbo].[User] (Id), 
     CONSTRAINT REL_InvoiceIssuer_User_Modified FOREIGN KEY (ModifiedByUserId) REFERENCES [dbo].[User] (Id)
-GO
+GO
+