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

namespace IoTSharp.Data.Sqlite.Migrations
{
    [DbContext(typeof(ApplicationDbContext))]
    partial class ApplicationDbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "5.0.12");

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

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("TenantId");

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

            modelBuilder.Entity("IoTSharp.Data.BaseDictionary", b =>
                {
                    b.Property<long>("DictionaryId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("DictionaryId");

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

            modelBuilder.Entity("IoTSharp.Data.BaseDictionaryGroup", b =>
                {
                    b.Property<long>("DictionaryGroupId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

                    b.HasKey("DictionaryGroupId");

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

            modelBuilder.Entity("IoTSharp.Data.BaseEvent", b =>
                {
                    b.Property<Guid>("EventId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<string>("BizData")
                        .HasColumnType("TEXT");

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

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

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

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

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

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

                    b.Property<Guid?>("FlowRuleRuleId")
                        .HasColumnType("TEXT");

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

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

                    b.HasKey("EventId");

                    b.HasIndex("FlowRuleRuleId");

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

            modelBuilder.Entity("IoTSharp.Data.BaseI18N", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("TenantId");

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

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

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

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

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

                    b.Property<DateTime>("DateTime")
                        .HasColumnType("TEXT");

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

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

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

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

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

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

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

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

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

                    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("TEXT");

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

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

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

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

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

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

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

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

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

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

                    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("TEXT");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("DeviceId");

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

            modelBuilder.Entity("IoTSharp.Data.DeviceRule", b =>
                {
                    b.Property<Guid>("DeviceRuleId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("ConfigDateTime")
                        .HasColumnType("TEXT");

                    b.Property<Guid>("ConfigUser")
                        .HasColumnType("TEXT");

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

                    b.Property<Guid?>("FlowRuleRuleId")
                        .HasColumnType("TEXT");

                    b.HasKey("DeviceRuleId");

                    b.HasIndex("DeviceId");

                    b.HasIndex("FlowRuleRuleId");

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

            modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldInfo", b =>
                {
                    b.Property<long>("FieldId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("FieldId");

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

            modelBuilder.Entity("IoTSharp.Data.DynamicFormFieldValueInfo", b =>
                {
                    b.Property<long>("FieldValueId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("FieldValueId");

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

            modelBuilder.Entity("IoTSharp.Data.DynamicFormInfo", b =>
                {
                    b.Property<long>("FormId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

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

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

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

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

                    b.HasKey("FormId");

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

            modelBuilder.Entity("IoTSharp.Data.Flow", b =>
                {
                    b.Property<Guid>("FlowId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

                    b.Property<DateTime>("CreateDate")
                        .HasColumnType("TEXT");

                    b.Property<Guid>("CreateId")
                        .HasColumnType("TEXT");

                    b.Property<Guid>("Createor")
                        .HasColumnType("TEXT");

                    b.Property<Guid?>("ExecutorId")
                        .HasColumnType("TEXT");

                    b.Property<Guid?>("FlowRuleRuleId")
                        .HasColumnType("TEXT");

                    b.Property<int>("FlowStatus")
                        .HasColumnType("INTEGER");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    b.Property<int>("TestStatus")
                        .HasColumnType("INTEGER");

                    b.Property<Guid>("Tester")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("TesterDateTime")
                        .HasColumnType("TEXT");

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

                    b.HasKey("FlowId");

                    b.HasIndex("ExecutorId");

                    b.HasIndex("FlowRuleRuleId");

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

            modelBuilder.Entity("IoTSharp.Data.FlowOperation", b =>
                {
                    b.Property<Guid>("OperationId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

                    b.Property<Guid?>("BaseEventEventId")
                        .HasColumnType("TEXT");

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

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

                    b.Property<Guid?>("FlowId")
                        .HasColumnType("TEXT");

                    b.Property<Guid?>("FlowRuleRuleId")
                        .HasColumnType("TEXT");

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

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

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

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

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

                    b.HasKey("OperationId");

                    b.HasIndex("BaseEventEventId");

                    b.HasIndex("FlowId");

                    b.HasIndex("FlowRuleRuleId");

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

            modelBuilder.Entity("IoTSharp.Data.FlowRule", b =>
                {
                    b.Property<Guid>("RuleId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

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

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

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

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

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

                    b.Property<int>("MountType")
                        .HasColumnType("INTEGER");

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

                    b.Property<Guid>("ParentRuleId")
                        .HasColumnType("TEXT");

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

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

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

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

                    b.Property<double>("SubVersion")
                        .HasColumnType("REAL");

                    b.HasKey("RuleId");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("CustomerId");

                    b.HasIndex("IdentityUserId");

                    b.HasIndex("TenantId");

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

            modelBuilder.Entity("IoTSharp.Data.RuleTaskExecutor", b =>
                {
                    b.Property<Guid>("ExecutorId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("AddDateTime")
                        .HasColumnType("TEXT");

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

                    b.Property<string>("DefaultConfig")
                        .HasColumnType("TEXT");

                    b.Property<string>("ExecutorDesc")
                        .HasColumnType("TEXT");

                    b.Property<string>("ExecutorName")
                        .HasColumnType("TEXT");

                    b.Property<int>("ExecutorStatus")
                        .HasColumnType("INTEGER");

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

                    b.Property<string>("Path")
                        .HasColumnType("TEXT");

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

                    b.Property<int>("TestStatus")
                        .HasColumnType("INTEGER");

                    b.Property<Guid>("Tester")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("TesterDateTime")
                        .HasColumnType("TEXT");

                    b.Property<string>("TypeName")
                        .HasColumnType("TEXT");

                    b.HasKey("ExecutorId");

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

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

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

                    b.Property<DateTime>("DateTime")
                        .HasColumnType("TEXT");

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

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

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

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

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

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

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

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

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

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

                    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("TEXT");

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

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex");

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

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

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

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

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

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

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

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

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

                    b.Property<DateTimeOffset?>("LockoutEnd")
                        .HasColumnType("TEXT");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

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

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex");

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

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("UserId");

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

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

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

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

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

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

                    b.HasIndex("UserId");

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

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

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

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

                    b.HasIndex("RoleId");

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

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

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

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

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

                    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.BaseEvent", b =>
                {
                    b.HasOne("IoTSharp.Data.FlowRule", "FlowRule")
                        .WithMany()
                        .HasForeignKey("FlowRuleRuleId");

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

            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.DeviceRule", b =>
                {
                    b.HasOne("IoTSharp.Data.Device", "Device")
                        .WithMany()
                        .HasForeignKey("DeviceId");

                    b.HasOne("IoTSharp.Data.FlowRule", "FlowRule")
                        .WithMany()
                        .HasForeignKey("FlowRuleRuleId");

                    b.Navigation("Device");

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

            modelBuilder.Entity("IoTSharp.Data.Flow", b =>
                {
                    b.HasOne("IoTSharp.Data.RuleTaskExecutor", "Executor")
                        .WithMany()
                        .HasForeignKey("ExecutorId");

                    b.HasOne("IoTSharp.Data.FlowRule", "FlowRule")
                        .WithMany()
                        .HasForeignKey("FlowRuleRuleId");

                    b.Navigation("Executor");

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

            modelBuilder.Entity("IoTSharp.Data.FlowOperation", b =>
                {
                    b.HasOne("IoTSharp.Data.BaseEvent", "BaseEvent")
                        .WithMany()
                        .HasForeignKey("BaseEventEventId");

                    b.HasOne("IoTSharp.Data.Flow", "Flow")
                        .WithMany()
                        .HasForeignKey("FlowId");

                    b.HasOne("IoTSharp.Data.FlowRule", "FlowRule")
                        .WithMany()
                        .HasForeignKey("FlowRuleRuleId");

                    b.Navigation("BaseEvent");

                    b.Navigation("Flow");

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

            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
        }
    }
}
