// <auto-generated />
using System;
using IoTSharp.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Oracle.EntityFrameworkCore.Metadata;

namespace IoTSharp.Data.Oracle.Migrations
{
    [DbContext(typeof(ApplicationDbContext))]
    [Migration("20211003182418_Oracle12CSchema")]
    partial class Oracle12CSchema
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("Relational:MaxIdentifierLength", 30)
                .HasAnnotation("ProductVersion", "5.0.10")
                .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("IoTSharp.Data.AuditLog", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ActionData")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ActionName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ActionResult")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime>("ActiveDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid>("ObjectID")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ObjectName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("ObjectType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("UserId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("UserName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("AuditLog");
                });

            modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("AuthToken")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

                    b.ToTable("AuthorizedKeys");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b =>
                {
                    b.Property<long>("DictionaryId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Dictionary18NKeyName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryColor")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("DictionaryGroupId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("DictionaryIcon")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryPattern")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("DictionaryStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("DictionaryTag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("DictionaryValueType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("DictionaryValueTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("DictionaryId");

                    b.ToTable("BaseDictionaries");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b =>
                {
                    b.Property<long>("DictionaryGroupId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("DictionaryGroup18NKeyName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryGroupDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryGroupKey")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DictionaryGroupName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("DictionaryGroupStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int?>("DictionaryGroupValueType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("DictionaryGroupValueTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("DictionaryGroupId");

                    b.ToTable("BaseDictionaryGroups");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseEvent", b =>
                {
                    b.Property<long>("EventId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Bizid")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime>("CreaterDateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("EventDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("EventName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("EventStaus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("MataData")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long>("RuleId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<int>("Type")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("EventId");

                    b.ToTable("BaseEvents");
                });

            modelBuilder.Entity("IoTSharp.Data.BaseI18N", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime?>("AddDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("KeyName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ResouceDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("ResouceGroupId")
                        .HasColumnType("NUMBER(10)");

                    b.Property<long?>("ResourceId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("ResourceKey")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ResourceTag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("ResourceType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int>("Status")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid>("UserId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("ValueBG")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueCS")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueDA")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueDEDE")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueELGR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueENGR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueENUS")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueESES")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueFI")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueFRFR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueHE")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueHRHR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueHU")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueITIT")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueJAJP")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueKOKR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueNL")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValuePLPL")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValuePT")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueSLSL")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueSR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueSV")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueTRTR")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueUK")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueVI")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueZHCN")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ValueZHTW")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Id");

                    b.ToTable("BaseI18Ns");
                });

            modelBuilder.Entity("IoTSharp.Data.Customer", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Address")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("City")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Country")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Email")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Phone")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Province")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Street")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("ZipCode")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("Id");

                    b.HasIndex("TenantId");

                    b.ToTable("Customer");
                });

            modelBuilder.Entity("IoTSharp.Data.DataStorage", b =>
                {
                    b.Property<int>("Catalog")
                        .HasColumnType("NUMBER(10)");

                    b.Property<Guid>("DeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("KeyName")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<int>("DataSide")
                        .HasColumnType("NUMBER(10)");

                    b.Property<DateTime>("DateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<int>("Type")
                        .HasColumnType("NUMBER(10)");

                    b.Property<byte[]>("Value_Binary")
                        .HasColumnType("RAW(2000)");

                    b.Property<bool?>("Value_Boolean")
                        .HasColumnType("NUMBER(1)");

                    b.Property<DateTime?>("Value_DateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<double?>("Value_Double")
                        .HasColumnType("BINARY_DOUBLE");

                    b.Property<string>("Value_Json")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("Value_Long")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("Value_String")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Value_XML")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Catalog", "DeviceId", "KeyName");

                    b.HasIndex("Catalog");

                    b.HasIndex("Catalog", "DeviceId");

                    b.ToTable("DataStorage");

                    b.HasDiscriminator<int>("Catalog").HasValue(0);
                });

            modelBuilder.Entity("IoTSharp.Data.Device", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("AuthorizedKeyId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("DeviceType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<DateTime>("LastActive")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<bool>("Online")
                        .HasColumnType("NUMBER(1)");

                    b.Property<Guid?>("OwnerId")
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.Property<int>("Timeout")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("Id");

                    b.HasIndex("AuthorizedKeyId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("OwnerId");

                    b.HasIndex("TenantId");

                    b.ToTable("Device");

                    b.HasDiscriminator<int>("DeviceType").HasValue(0);
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("DeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("IdentityId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("IdentityType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("IdentityValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("Id");

                    b.HasIndex("DeviceId");

                    b.ToTable("DeviceIdentities");
                });

            modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b =>
                {
                    b.Property<long>("FieldId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("FieldCode")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime?>("FieldCreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<DateTime?>("FieldEditDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("FieldI18nKey")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FieldMaxLength")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("FieldName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldPattern")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldPocoTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FieldStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<long?>("FieldUIElement")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("FieldUIElementSchema")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldUnit")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValueDataSource")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValueLocalDataSource")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FieldValueType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("FieldValueTypeName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("FormId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<bool?>("IsEnabled")
                        .HasColumnType("NUMBER(1)");

                    b.Property<bool?>("IsRequired")
                        .HasColumnType("NUMBER(1)");

                    b.HasKey("FieldId");

                    b.ToTable("DynamicFormFieldInfos");
                });

            modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b =>
                {
                    b.Property<long>("FieldValueId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<long?>("BizId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("FieldCode")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<DateTime?>("FieldCreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<long?>("FieldId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("FieldName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldUnit")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FieldValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("FieldValueType")
                        .HasColumnType("NUMBER(19)");

                    b.Property<long?>("FromId")
                        .HasColumnType("NUMBER(19)");

                    b.HasKey("FieldValueId");

                    b.ToTable("DynamicFormFieldValueInfos");
                });

            modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b =>
                {
                    b.Property<long>("FormId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<long?>("BizId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<Guid>("Creator")
                        .HasColumnType("RAW(16)");

                    b.Property<long?>("FormCreator")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("FormDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FormLayout")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FormName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FormSchame")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("FormStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<DateTime?>("FromCreateDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<bool>("IsCompact")
                        .HasColumnType("NUMBER(1)");

                    b.Property<string>("ModelClass")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Url")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("FormId");

                    b.ToTable("DynamicFormInfos");
                });

            modelBuilder.Entity("IoTSharp.Data.Flow", b =>
                {
                    b.Property<long>("FlowId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Conditionexpression")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("FlowType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Flowdesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Flowname")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Incoming")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessClass")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessMethod")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessParams")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessScript")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessScriptType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("NodeProcessType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ObjectId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Outgoing")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long>("RuleId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("SourceId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("TargetId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("bpmnid")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("FlowId");

                    b.ToTable("Flows");
                });

            modelBuilder.Entity("IoTSharp.Data.FlowOperation", b =>
                {
                    b.Property<long>("OperationId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime?>("AddDate")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("BizId")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Data")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long>("EventId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<long>("FlowId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<int?>("NodeStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("OperationDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long>("RuleId")
                        .HasColumnType("NUMBER(19)");

                    b.Property<int>("Step")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("Tag")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("bpmnid")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("OperationId");

                    b.ToTable("FlowOperations");
                });

            modelBuilder.Entity("IoTSharp.Data.FlowRule", b =>
                {
                    b.Property<long>("RuleId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(19)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime?>("CreatTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<string>("Creator")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("DefinitionsXml")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Describes")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ExecutableCode")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("RuleDesc")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int?>("RuleStatus")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int>("RuleType")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("Runner")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("RuleId");

                    b.ToTable("FlowRules");
                });

            modelBuilder.Entity("IoTSharp.Data.Relationship", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<Guid?>("CustomerId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("IdentityUserId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<Guid?>("TenantId")
                        .HasColumnType("RAW(16)");

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("IdentityUserId");

                    b.HasIndex("TenantId");

                    b.ToTable("Relationship");
                });

            modelBuilder.Entity("IoTSharp.Data.TelemetryData", b =>
                {
                    b.Property<Guid>("DeviceId")
                        .HasColumnType("RAW(16)");

                    b.Property<string>("KeyName")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<DateTime>("DateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<int>("DataSide")
                        .HasColumnType("NUMBER(10)");

                    b.Property<int>("Type")
                        .HasColumnType("NUMBER(10)");

                    b.Property<byte[]>("Value_Binary")
                        .HasColumnType("RAW(2000)");

                    b.Property<bool?>("Value_Boolean")
                        .HasColumnType("NUMBER(1)");

                    b.Property<DateTime?>("Value_DateTime")
                        .HasColumnType("TIMESTAMP(7)");

                    b.Property<double?>("Value_Double")
                        .HasColumnType("BINARY_DOUBLE");

                    b.Property<string>("Value_Json")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<long?>("Value_Long")
                        .HasColumnType("NUMBER(19)");

                    b.Property<string>("Value_String")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Value_XML")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("DeviceId", "KeyName", "DateTime");

                    b.HasIndex("DeviceId");

                    b.HasIndex("KeyName");

                    b.HasIndex("DeviceId", "KeyName");

                    b.ToTable("TelemetryData");
                });

            modelBuilder.Entity("IoTSharp.Data.Tenant", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("RAW(16)");

                    b.Property<string>("Address")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("City")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Country")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("EMail")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Phone")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Province")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Street")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<int>("ZipCode")
                        .HasColumnType("NUMBER(10)");

                    b.HasKey("Id");

                    b.ToTable("Tenant");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<string>("NormalizedName")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex")
                        .HasFilter("\"NormalizedName\" IS NOT NULL");

                    b.ToTable("AspNetRoles");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(10)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("ClaimType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("RoleId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetRoleClaims");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<int>("AccessFailedCount")
                        .HasColumnType("NUMBER(10)");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("Email")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<bool>("EmailConfirmed")
                        .HasColumnType("NUMBER(1)");

                    b.Property<bool>("LockoutEnabled")
                        .HasColumnType("NUMBER(1)");

                    b.Property<DateTimeOffset?>("LockoutEnd")
                        .HasColumnType("TIMESTAMP(7) WITH TIME ZONE");

                    b.Property<string>("NormalizedEmail")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<string>("NormalizedUserName")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.Property<string>("PasswordHash")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("PhoneNumber")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<bool>("PhoneNumberConfirmed")
                        .HasColumnType("NUMBER(1)");

                    b.Property<string>("SecurityStamp")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<bool>("TwoFactorEnabled")
                        .HasColumnType("NUMBER(1)");

                    b.Property<string>("UserName")
                        .HasMaxLength(256)
                        .HasColumnType("NVARCHAR2(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedEmail")
                        .HasDatabaseName("EmailIndex");

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex")
                        .HasFilter("\"NormalizedUserName\" IS NOT NULL");

                    b.ToTable("AspNetUsers");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("NUMBER(10)")
                        .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("ClaimType")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("UserId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserClaims");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.Property<string>("LoginProvider")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("ProviderKey")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("ProviderDisplayName")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.Property<string>("UserId")
                        .IsRequired()
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("LoginProvider", "ProviderKey");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserLogins");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                {
                    b.Property<string>("UserId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("RoleId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetUserRoles");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                {
                    b.Property<string>("UserId")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("LoginProvider")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("Name")
                        .HasColumnType("NVARCHAR2(450)");

                    b.Property<string>("Value")
                        .HasColumnType("NVARCHAR2(2000)");

                    b.HasKey("UserId", "LoginProvider", "Name");

                    b.ToTable("AspNetUserTokens");
                });

            modelBuilder.Entity("IoTSharp.Data.AttributeLatest", b =>
                {
                    b.HasBaseType("IoTSharp.Data.DataStorage");

                    b.HasDiscriminator().HasValue(2);
                });

            modelBuilder.Entity("IoTSharp.Data.TelemetryLatest", b =>
                {
                    b.HasBaseType("IoTSharp.Data.DataStorage");

                    b.HasDiscriminator().HasValue(4);
                });

            modelBuilder.Entity("IoTSharp.Data.Gateway", b =>
                {
                    b.HasBaseType("IoTSharp.Data.Device");

                    b.HasDiscriminator().HasValue(1);
                });

            modelBuilder.Entity("IoTSharp.Data.AuditLog", b =>
                {
                    b.HasOne("IoTSharp.Data.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId");

                    b.HasOne("IoTSharp.Data.Tenant", "Tenant")
                        .WithMany()
                        .HasForeignKey("TenantId");

                    b.Navigation("Customer");

                    b.Navigation("Tenant");
                });

            modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b =>
                {
                    b.HasOne("IoTSharp.Data.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId");

                    b.HasOne("IoTSharp.Data.Tenant", "Tenant")
                        .WithMany()
                        .HasForeignKey("TenantId");

                    b.Navigation("Customer");

                    b.Navigation("Tenant");
                });

            modelBuilder.Entity("IoTSharp.Data.Customer", b =>
                {
                    b.HasOne("IoTSharp.Data.Tenant", "Tenant")
                        .WithMany("Customers")
                        .HasForeignKey("TenantId");

                    b.Navigation("Tenant");
                });

            modelBuilder.Entity("IoTSharp.Data.Device", b =>
                {
                    b.HasOne("IoTSharp.Data.AuthorizedKey", null)
                        .WithMany("Devices")
                        .HasForeignKey("AuthorizedKeyId");

                    b.HasOne("IoTSharp.Data.Customer", "Customer")
                        .WithMany("Devices")
                        .HasForeignKey("CustomerId");

                    b.HasOne("IoTSharp.Data.Gateway", "Owner")
                        .WithMany("Children")
                        .HasForeignKey("OwnerId");

                    b.HasOne("IoTSharp.Data.Tenant", "Tenant")
                        .WithMany("Devices")
                        .HasForeignKey("TenantId");

                    b.Navigation("Customer");

                    b.Navigation("Owner");

                    b.Navigation("Tenant");
                });

            modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b =>
                {
                    b.HasOne("IoTSharp.Data.Device", "Device")
                        .WithMany()
                        .HasForeignKey("DeviceId");

                    b.Navigation("Device");
                });

            modelBuilder.Entity("IoTSharp.Data.Relationship", b =>
                {
                    b.HasOne("IoTSharp.Data.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId");

                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", "IdentityUser")
                        .WithMany()
                        .HasForeignKey("IdentityUserId");

                    b.HasOne("IoTSharp.Data.Tenant", "Tenant")
                        .WithMany()
                        .HasForeignKey("TenantId");

                    b.Navigation("Customer");

                    b.Navigation("IdentityUser");

                    b.Navigation("Tenant");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
                {
                    b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b =>
                {
                    b.Navigation("Devices");
                });

            modelBuilder.Entity("IoTSharp.Data.Customer", b =>
                {
                    b.Navigation("Devices");
                });

            modelBuilder.Entity("IoTSharp.Data.Tenant", b =>
                {
                    b.Navigation("Customers");

                    b.Navigation("Devices");
                });

            modelBuilder.Entity("IoTSharp.Data.Gateway", b =>
                {
                    b.Navigation("Children");
                });
#pragma warning restore 612, 618
        }
    }
}
