diff --git a/.gitignore b/.gitignore index 0fb70a901e57e9cd4107997af83c10606c244bf4..e1ca3c60bb9946a0e823547840583c4a3ad08297 100644 --- a/.gitignore +++ b/.gitignore @@ -344,3 +344,6 @@ ASALocalRun/ /rabbitmq /Deployments/zeromq_taos/postgresql /taos/data +/IoTSharp/TelemetryStorage.db +/IoTSharp/IoTSharp.db +/IoTSharp/health_checks.db diff --git a/IoTSharp.ClientApp/wwwroot/css/site.css b/IoTSharp.ClientApp/wwwroot/css/site.css index 27a80cf10d06f12bc4ab047a845282860c891f8f..e2cc74a387195a3a8ef2a29e131f3b3ec01c1379 100644 --- a/IoTSharp.ClientApp/wwwroot/css/site.css +++ b/IoTSharp.ClientApp/wwwroot/css/site.css @@ -1 +1 @@ -.container__b__0{display:flex;flex-direction:column;height:100vh;overflow:auto;background:#f0f2f5}.container__b__0 .lang{width:100%;height:40px;line-height:44px;text-align:right}.container__b__0 .lang :global(.ant-dropdown-trigger){margin-right:24px}.container__b__0 .content{flex:1;padding:32px 0}.container__b__0 .top{text-align:center}.container__b__0 .header{height:44px;line-height:44px}.container__b__0 .header a{text-decoration:none}.container__b__0 .logo{height:44px;margin-right:16px;vertical-align:top}.container__b__0 .title{position:relative;top:2px;color:rgba(0,0,0,.85);font-weight:600;font-size:33px;font-family:Avenir,'Helvetica Neue',Arial,Helvetica,sans-serif}.container__b__0 .desc{margin-top:12px;margin-bottom:40px;color:rgba(0,0,0,.45);font-size:14px}@media (min-width:768px){.container__b__0{background-image:url(https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg);background-repeat:no-repeat;background-position:center 110px;background-size:100%}.container__b__0 .content{padding:32px 0 24px}}#app,#root,app,body,html{height:100%}.colorWeak{filter:invert(80%)}.ant-layout{min-height:100vh}canvas{display:block}body{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}ol,ul{list-style:none}@media (max-width:480px){.ant-table{width:100%;overflow-x:auto}.ant-table-tbody>tr>td,.ant-table-tbody>tr>th,.ant-table-thead>tr>td,.ant-table-thead>tr>th{white-space:pre}.ant-table-tbody>tr>td>span,.ant-table-tbody>tr>th>span,.ant-table-thead>tr>td>span,.ant-table-thead>tr>th>span{display:block}}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){body .ant-design-pro>.ant-layout{min-height:100vh}}.avatarHolder{margin-bottom:24px;text-align:center}.avatarHolder>img{width:104px;height:104px;margin-bottom:20px}.avatarHolder .name{margin-bottom:4px;color:rgba(0,0,0,.85);font-weight:500;font-size:20px;line-height:28px}.detail p{position:relative;margin-bottom:8px;padding-left:26px}.detail p:last-child{margin-bottom:0}.detail i{position:absolute;top:4px;left:0;width:14px;height:14px}.tagsTitle,.teamTitle{margin-bottom:12px;color:rgba(0,0,0,.85);font-weight:500}.tags .ant-tag{margin-bottom:8px}.team .ant-avatar{margin-right:12px}.team a{display:block;margin-bottom:24px;overflow:hidden;color:rgba(0,0,0,.85);white-space:nowrap;text-overflow:ellipsis;word-break:break-all;transition:color .3s}.team a:hover{color:#1890ff}.tabsCard .ant-card-head{padding:0 16px}.main__b__2{display:flex;width:100%;height:100%;padding-top:16px;padding-bottom:16px;overflow:auto;background-color:#fff}.main__b__2 .leftMenu{width:224px;border-right:1px solid #f0f0f0}.main__b__2 .leftMenu :global .ant-menu-inline{border:none}.main__b__2 .leftMenu :global .ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected{font-weight:700}.main__b__2 .right__b__0{flex:1;padding-top:8px;padding-right:40px;padding-bottom:8px;padding-left:40px}.main__b__2 .right__b__0 .title{margin-bottom:12px;color:rgba(0,0,0,.85);font-weight:500;font-size:20px;line-height:28px}.main__b__2 .ant-list-split .ant-list-item:last-child{border-bottom:1px solid #f0f0f0}.main__b__2 .ant-list-item{padding-top:14px;padding-bottom:14px}.ant-list-item-meta .taobao{display:block;color:#ff4000;font-size:48px;line-height:48px;border-radius:2px}.ant-list-item-meta .dingding{margin:2px;padding:6px;color:#fff;font-size:32px;line-height:32px;background-color:#2eabff;border-radius:2px}.ant-list-item-meta .alipay{color:#2eabff;font-size:48px;line-height:48px;border-radius:2px}font.strong{color:#52c41a}font.medium{color:#faad14}font.weak{color:#ff4d4f}@media screen and (max-width:768px){.main__b__2{flex-direction:column}.main__b__2 .leftMenu{width:100%;border:none}.main__b__2 .right__b__0{padding:40px}}.iconGroup span.anticon{margin-left:16px;color:rgba(0,0,0,.45);cursor:pointer;transition:color .32s}.iconGroup span.anticon:hover{color:rgba(0,0,0,.85)}.rankingList{margin:25px 0 0;padding:0;list-style:none}.rankingList li{display:flex;align-items:center;margin-top:16px;zoom:1}.rankingList li::after,.rankingList li::before{display:table;content:' '}.rankingList li::after{clear:both;height:0;font-size:0;visibility:hidden}.rankingList li span{color:rgba(0,0,0,.85);font-size:14px;line-height:22px}.rankingList li .rankingItemNumber{display:inline-block;width:20px;height:20px;margin-top:1.5px;margin-right:16px;font-weight:600;font-size:12px;line-height:20px;text-align:center;background-color:#fafafa;border-radius:20px}.rankingList li .rankingItemNumber.active{color:#fff;background-color:#314659}.rankingList li .rankingItemTitle{flex:1;margin-right:8px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.salesExtra{display:inline-block;margin-right:24px}.salesExtra a{margin-left:24px;color:rgba(0,0,0,.85)}.salesExtra a:hover{color:#1890ff}.salesExtra a.currentDate{color:#1890ff}.salesCard .salesBar{padding:0 0 32px 32px}.salesCard .salesRank{padding:0 32px 32px 72px}.salesCard :global .ant-tabs-bar,.salesCard :global .ant-tabs-nav-wrap{padding-left:16px}.salesCard :global .ant-tabs-bar .ant-tabs-nav .ant-tabs-tab,.salesCard :global .ant-tabs-nav-wrap .ant-tabs-nav .ant-tabs-tab{padding-top:16px;padding-bottom:14px;line-height:24px}.salesCard :global .ant-tabs-extra-content{padding-right:24px;line-height:55px}.salesCard :global .ant-card-head{position:relative}.salesCard :global .ant-card-head-title{align-items:normal}.salesCardExtra{height:inherit}.salesTypeRadio{position:absolute;right:54px;bottom:12px}.offlineCard :global .ant-tabs-ink-bar{bottom:auto}.offlineCard :global .ant-tabs-bar{border-bottom:none}.offlineCard :global .ant-tabs-nav-container-scrolling{padding-right:40px;padding-left:40px}.offlineCard :global .ant-tabs-tab-prev-icon::before{position:relative;left:6px}.offlineCard :global .ant-tabs-tab-next-icon::before{position:relative;right:6px}.offlineCard :global .ant-tabs-tab-active h4{color:#1890ff}.trendText{margin-left:8px;color:rgba(0,0,0,.85)}@media screen and (max-width:992px){.salesExtra{display:none}.rankingList li span:first-child{margin-right:8px}}@media screen and (max-width:768px){.rankingTitle{margin-top:16px}.salesCard .salesBar{padding:16px}}@media screen and (max-width:576px){.salesExtraWrap{display:none}.salesCard :global .ant-tabs-content{padding-top:30px}}.mapChart{height:452px;padding-top:24px}.mapChart img{display:inline-block;max-width:100%;max-height:437px}.pieCard :global(.pie-stat){font-size:24px!important}@media screen and (max-width:992px){.mapChart{height:auto}}.activitiesList{padding:0 24px 8px 24px}.activitiesList .username{color:rgba(0,0,0,.85)}.activitiesList .event{font-weight:400}.pageHeaderContent__b__0{display:flex}.pageHeaderContent__b__0 .avatar{flex:0 1 72px}.pageHeaderContent__b__0 .avatar>span{display:block;width:72px;height:72px;border-radius:72px}.pageHeaderContent__b__0 .content{position:relative;top:4px;flex:1 1 auto;margin-left:24px;color:rgba(0,0,0,.45);line-height:22px}.pageHeaderContent__b__0 .content .contentTitle{margin-bottom:12px;color:rgba(0,0,0,.85);font-weight:500;font-size:20px;line-height:28px}.extraContent{zoom:1;float:right;white-space:nowrap}.extraContent::after,.extraContent::before{display:table;content:' '}.extraContent::after{clear:both;height:0;font-size:0;visibility:hidden}.extraContent .statItem{position:relative;display:inline-block;padding:0 32px}.extraContent .statItem>p:first-child{margin-bottom:4px;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.extraContent .statItem>p{margin:0;color:rgba(0,0,0,.85);font-size:30px;line-height:38px}.extraContent .statItem>p>span{color:rgba(0,0,0,.45);font-size:20px}.extraContent .statItem::after{position:absolute;top:8px;right:0;width:1px;height:40px;background-color:#f0f0f0;content:''}.extraContent .statItem:last-child{padding-right:0}.extraContent .statItem:last-child::after{display:none}.members a{display:block;height:24px;margin:12px 0;color:rgba(0,0,0,.85);transition:all .3s;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.members a .member{margin-left:12px;font-size:14px;line-height:24px;vertical-align:top}.members a:hover{color:#1890ff}.projectList .ant-card-meta-description{height:44px;overflow:hidden;color:rgba(0,0,0,.45);line-height:22px}.projectList .cardTitle{font-size:0}.projectList .cardTitle a{display:inline-block;height:24px;margin-left:12px;color:rgba(0,0,0,.85);font-size:14px;line-height:24px;vertical-align:top}.projectList .cardTitle a:hover{color:#1890ff}.projectList .projectGrid{width:33.33%}.projectList .projectItemContent{display:flex;height:20px;margin-top:8px;font-size:12px;line-height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.projectList .projectItemContent a{display:inline-block;flex:1 1 0;color:rgba(0,0,0,.45);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.projectList .projectItemContent a:hover{color:#1890ff}.projectList .projectItemContent .datetime{flex:0 0 auto;float:right;color:rgba(0,0,0,.25)}.datetime{color:rgba(0,0,0,.25)}@media screen and (max-width:1200px) and (min-width:992px){.activeCard{margin-bottom:24px}.members{margin-bottom:0}.extraContent{margin-left:-44px}.extraContent .statItem{padding:0 16px}}@media screen and (max-width:992px){.activeCard{margin-bottom:24px}.members{margin-bottom:0}.extraContent{float:none;margin-right:0}.extraContent .statItem{padding:0 16px;text-align:left}.extraContent .statItem::after{display:none}}@media screen and (max-width:768px){.extraContent{margin-left:-16px}.projectList .projectGrid{width:50%}}@media screen and (max-width:576px){.pageHeaderContent{display:block}.pageHeaderContent .content{margin-left:0}.extraContent .statItem{float:none}}@media screen and (max-width:480px){.projectList .projectGrid{width:100%}}.card{margin-bottom:24px}.card :global .ant-legacy-form-item .ant-legacy-form-item-control-wrapper{width:100%}.errorIcon{margin-right:24px;color:#ff4d4f;cursor:pointer}.errorIcon span.anticon{margin-right:4px}.errorPopover :global .ant-popover-inner-content{min-width:256px;max-height:290px;padding:0;overflow:auto}.errorListItem{padding:8px 16px;list-style:none;border-bottom:1px solid #f0f0f0;cursor:pointer;transition:all .3s}.errorListItem:hover{background:#e6f7ff}.errorListItem:last-child{border:0}.errorListItem .errorIcon{float:left;margin-top:4px;margin-right:12px;padding-bottom:22px;color:#ff4d4f}.errorListItem .errorField{margin-top:2px;color:rgba(0,0,0,.45);font-size:12px}.editable td{padding-top:13px!important;padding-bottom:12.5px!important}.card{margin-bottom:24px}.card :global .ant-legacy-form-item .ant-legacy-form-item-control-wrapper{width:100%}.errorIcon{margin-right:24px;color:#ff4d4f;cursor:pointer}.errorIcon span.anticon{margin-right:4px}.errorPopover :global .ant-popover-inner-content{min-width:256px;max-height:290px;padding:0;overflow:auto}.errorListItem{padding:8px 16px;list-style:none;border-bottom:1px solid #f0f0f0;cursor:pointer;transition:all .3s}.errorListItem:hover{background:#e6f7ff}.errorListItem:last-child{border:0}.errorListItem .errorIcon{float:left;margin-top:4px;margin-right:12px;padding-bottom:22px;color:#ff4d4f}.errorListItem .errorField{margin-top:2px;color:rgba(0,0,0,.45);font-size:12px}.editable td{padding-top:13px!important;padding-bottom:12.5px!important}.card{margin-bottom:24px}.heading{margin:0 0 16px 0;font-size:14px;line-height:22px}.steps.ant-steps{max-width:750px;margin:16px auto}.errorIcon{margin-right:24px;color:#ff4d4f;cursor:pointer}.errorIcon span.anticon{margin-right:4px}.errorPopover :global .ant-popover-inner-content{min-width:256px;max-height:290px;padding:0;overflow:auto}.errorListItem{padding:8px 16px;list-style:none;border-bottom:1px solid #f0f0f0;cursor:pointer;transition:all .3s}.errorListItem:hover{background:#e6f7ff}.errorListItem:last-child{border:0}.errorListItem .errorIcon{float:left;margin-top:4px;margin-right:12px;padding-bottom:22px;color:#ff4d4f}.errorListItem .errorField{margin-top:2px;color:rgba(0,0,0,.45);font-size:12px}.editable td{padding-top:13px!important;padding-bottom:12.5px!important}.advancedForm+div{padding-bottom:64px}.advancedForm :global .ant-form .ant-row:last-child .ant-form-item{margin-bottom:24px}.advancedForm :global .ant-table td{transition:none!important}.optional{color:rgba(0,0,0,.45);font-style:normal}.standardList .ant-card-head{border-bottom:none}.standardList .ant-card-head-title{padding:24px 0;line-height:32px}.standardList .ant-card-extra{padding:24px 0}.standardList .ant-list-pagination{margin-top:24px;text-align:right}.standardList .ant-avatar-lg{width:48px;height:48px;line-height:48px}.standardList .headerInfo{position:relative;text-align:center}.standardList .headerInfo>span{display:inline-block;margin-bottom:4px;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.standardList .headerInfo>p{margin:0;color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.standardList .headerInfo>em{position:absolute;top:0;right:0;width:1px;height:56px;background-color:#f0f0f0}.standardList .listContent{font-size:0}.standardList .listContent .listContentItem{display:inline-block;margin-left:40px;color:rgba(0,0,0,.45);font-size:14px;vertical-align:middle}.standardList .listContent .listContentItem>span{line-height:20px}.standardList .listContent .listContentItem>p{margin-top:4px;margin-bottom:0;line-height:22px}.standardList .extraContentSearch{width:272px;margin-left:16px}@media screen and (max-width:480px){.standardList .ant-list-item-content{display:block;flex:none;width:100%}.standardList .ant-list-item-action{margin-left:0}.standardList .listContent{margin-left:0}.standardList .listContent>div{margin-left:0}.standardList .listCard .ant-card-head-title{overflow:visible}}@media screen and (max-width:576px){.standardList .extraContentSearch{width:100%;margin-left:0}.standardList .headerInfo{margin-bottom:16px}.standardList .headerInfo>em{display:none}}@media screen and (max-width:768px){.standardList .listContent>div{display:block}.standardList .listContent>div:last-child{top:0;width:100%}.listCard .ant-radio-group{display:block;margin-bottom:8px}}@media screen and (max-width:992px) and (min-width:768px){.standardList .listContent>div{display:block}.standardList .listContent>div:last-child{top:0;width:100%}}@media screen and (max-width:1200px){.standardList .listContent>div{margin-left:24px}.standardList .listContent>div:last-child{top:0}}@media screen and (max-width:1400px){.standardList .listContent{text-align:right}.standardList .listContent>div:last-child{top:0}}.standardListForm .ant-form-item{margin-bottom:12px}.standardListForm .ant-form-item:last-child{margin-bottom:32px;padding-top:4px}.formResult{width:100%}.formResult [class^=title]{margin-bottom:8px}.cardList .card .ant-card-meta-title{margin-bottom:12px}.cardList .card .ant-card-meta-title>a{display:inline-block;max-width:100%;color:rgba(0,0,0,.85)}.cardList .card .ant-card-body:hover .ant-card-meta-title>a{color:#1890ff}.cardList .item{height:64px}.cardList .ant-list .ant-list-item-content-single{max-width:100%}.extraImg{width:155px;margin-top:-20px;text-align:center}.extraImg img{width:100%}.newButton{width:100%;height:201px;color:rgba(0,0,0,.45);background-color:#fff;border-color:#d9d9d9}.cardAvatar{width:48px;height:48px;border-radius:48px}.cardDescription{position:relative;max-height:4.5em;margin-right:-1em;padding-right:1em;overflow:hidden;line-height:1.5em;text-align:justify}.cardDescription::before{position:absolute;right:14px;bottom:0;padding:0 1px;background:#fff;content:'...'}.cardDescription::after{position:absolute;right:14px;width:1em;height:1em;margin-top:.2em;background:#fff;content:''}.pageHeaderContent__b__1{position:relative}.contentLink{margin-top:16px}.contentLink a{margin-right:32px}.contentLink a img{width:24px}.contentLink img{margin-right:8px;vertical-align:middle}@media screen and (max-width:992px){.contentLink a{margin-right:16px}}@media screen and (max-width:768px){.extraImg{display:none}}@media screen and (max-width:576px){.pageHeaderContent__b__1{padding-bottom:30px}.contentLink{position:absolute;bottom:-4px;left:0;width:1000px}.contentLink a{margin-right:16px}.contentLink img{margin-right:4px}}.main__b__3 .ant-descriptions-row>td{padding-bottom:8px}.main__b__3 .ant-page-header-heading-extra{flex-direction:column}.headerList{margin-bottom:4px}.headerList .ant-descriptions-row>td{padding-bottom:8px}.headerList .stepDescription{position:relative;left:38px;padding-top:8px;font-size:14px;text-align:left}.headerList .stepDescription>div{margin-top:8px;margin-bottom:4px}.pageHeader .ant-page-header-heading-extra>*+*{margin-left:8px}.pageHeader .moreInfo{display:flex;justify-content:space-between;width:200px}@media screen and (max-width:576px){.stepDescription{left:8px}.pageHeader .ant-pro-page-header-wrap-row{flex-direction:column}}.title{margin-bottom:16px;color:rgba(0,0,0,.85);font-weight:500;font-size:16px}.error_icon{color:#ff4d4f}.title__b__0{margin-bottom:16px;color:rgba(0,0,0,.85);font-weight:500;font-size:16px}.title__b__1{position:relative;color:rgba(0,0,0,.85);font-size:12px;text-align:center}.head-title{margin-bottom:20px;color:rgba(0,0,0,.85);font-weight:500px;font-size:16px}.main__b__0{width:368px;margin:0 auto}@media screen and (max-width:576px){.main__b__0{width:95%}}.main__b__0 .login :global .ant-tabs .ant-tabs-bar{margin-bottom:24px;text-align:center;border-bottom:0}.main__b__0 .login .getCaptcha{display:block;width:100%}.main__b__0 .login .icon{color:#1890ff}.main__b__0 .login .other{margin-top:24px;line-height:22px;text-align:left}.main__b__0 .login .other .icon{margin-left:16px;color:rgba(0,0,0,.45);font-size:24px;vertical-align:middle;cursor:pointer;transition:color .3s}.main__b__0 .login .other .icon:hover{color:#1890ff}.main__b__0 .login .other .register{float:right}.main__b__0 .login .prefixIcon{color:rgba(0,0,0,.25);font-size:14px}.main__b__0 .login .submit{width:100%;margin-top:24px}.main__b__1{width:368px;margin:0 auto}.main__b__1 h3{margin-bottom:20px;font-size:16px}.main__b__1 .password{margin-bottom:24px}.main__b__1 .password :global .ant-form-item-explain{display:none}.main__b__1 .getCaptcha{display:block;width:100%}.main__b__1 .submit{width:50%}.main__b__1 .login{float:right;line-height:40px}.error,.success,.warning{transition:color .3s}.success{color:#52c41a}.warning{color:#faad14}.error{color:#ff4d4f}.progress-pass>.progress :global .ant-progress-bg{background-color:#faad14}.registerResult{width:800px;min-height:400px;margin:auto;padding:80px;background:0 0}.registerResult :global .anticon{font-size:64px}.registerResult .title{margin-top:32px;font-size:20px;line-height:28px}.registerResult .actions{margin-top:40px}.registerResult .actions a+a{margin-left:8px}.baseView{display:flex;padding-top:12px}.baseView :global .ant-legacy-form-item .ant-legacy-form-item-control-wrapper{width:100%}.baseView .left{min-width:224px;max-width:448px}.baseView .right__b__1{flex:1;padding-left:104px}.baseView .right__b__1 .avatar_title{height:22px;margin-bottom:8px;color:rgba(0,0,0,.85);font-size:14px;line-height:22px}.baseView .right__b__1 .avatar{width:144px;height:144px;margin-bottom:12px;overflow:hidden}.baseView .right__b__1 .avatar img{width:100%}.baseView .right__b__1 .button_view{width:144px;text-align:center}@media screen and (max-width:1200px){.baseView{flex-direction:column-reverse}.baseView .right__b__1{display:flex;flex-direction:column;align-items:center;max-width:448px;padding:20px}.baseView .right__b__1 .avatar_title{display:none}}.row .item{width:50%;max-width:220px}.row .item:first-child{width:calc(50% - 8px);margin-right:8px}@media screen and (max-width:576px){.item:first-child{margin:0;margin-bottom:8px}}.area_code{width:30%;max-width:128px;margin-right:8px}.phone_number{width:calc(70% - 8px);max-width:312px}.filterCardList .ant-card-meta-content{margin-top:0}.filterCardList .ant-card-meta-avatar{font-size:0}.filterCardList .ant-list .ant-list-item-content-single{max-width:100%}.filterCardList .cardInfo{margin-top:16px;margin-left:40px;zoom:1}.filterCardList .cardInfo::after,.filterCardList .cardInfo::before{display:table;content:' '}.filterCardList .cardInfo::after{clear:both;height:0;font-size:0;visibility:hidden}.filterCardList .cardInfo>div{position:relative;float:left;width:50%;text-align:left}.filterCardList .cardInfo>div p{margin:0;font-size:24px;line-height:32px}.filterCardList .cardInfo>div p:first-child{margin-bottom:4px;color:rgba(0,0,0,.45);font-size:12px;line-height:20px}a.listItemMetaTitle{color:rgba(0,0,0,.85)}.listItemExtra{width:272px;height:1px}.selfTrigger{margin-left:12px}@media screen and (max-width:480px){.selfTrigger{display:block;margin-left:0}}@media screen and (max-width:768px){.selfTrigger{display:block;margin-left:0}}@media screen and (max-width:992px){.listItemExtra{width:0;height:1px}}.filterCardList{margin-bottom:-24px}.filterCardList :global .ant-card-meta-content{margin-top:0}.filterCardList :global .ant-card-meta-avatar{font-size:0}.filterCardList :global .ant-list .ant-list-item-content-single{max-width:100%}.filterCardList .cardInfo{margin-top:16px;margin-left:40px;zoom:1}.filterCardList .cardInfo::after,.filterCardList .cardInfo::before{display:table;content:' '}.filterCardList .cardInfo::after{clear:both;height:0;font-size:0;visibility:hidden}.filterCardList .cardInfo>div{position:relative;float:left;width:50%;text-align:left}.filterCardList .cardInfo>div p{margin:0;font-size:24px;line-height:32px}.filterCardList .cardInfo>div p:first-child{margin-bottom:4px;color:rgba(0,0,0,.45);font-size:12px;line-height:20px}.listContent .description{max-width:720px;line-height:22px}.listContent .extra{margin-top:16px;color:rgba(0,0,0,.45);line-height:22px}.listContent .extra>:global(.ant-avatar){position:relative;top:1px;width:20px;height:20px;margin-right:8px;vertical-align:top}.listContent .extra>em{margin-left:16px;color:rgba(0,0,0,.25);font-style:normal}@media screen and (max-width:480px){.listContent .extra>em{display:block;margin-top:8px;margin-left:0}}.articleList :global .ant-list-item:first-child{padding-top:0}a.listItemMetaTitle{color:rgba(0,0,0,.85)}.avatarList{display:inline-block}.avatarList ul{display:inline-block;margin-left:8px;font-size:0}.avatarItem{display:inline-block;width:32px;height:32px;margin-left:-8px;font-size:14px}.avatarItem :global .ant-avatar{border:1px solid #d9d9d9}.avatarItemLarge{width:40px;height:40px}.avatarItemSmall{width:24px;height:24px}.avatarItemMini{width:20px;height:20px}.avatarItemMini :global .ant-avatar{width:20px;height:20px;line-height:20px}.avatarItemMini :global .ant-avatar .ant-avatar-string{font-size:12px;line-height:18px}.miniChart{position:relative;width:100%}.miniChart .chartContent{position:absolute;bottom:-28px;width:100%}.miniChart .chartContent>div{margin:0 -5px;overflow:hidden}.miniChart .chartLoading{position:absolute;top:16px;left:50%;margin-left:-7px}.coverCardList .card .ant-card-meta-title{margin-bottom:4px}.coverCardList .card .ant-card-meta-title>a{display:inline-block;max-width:100%;color:rgba(0,0,0,.85)}.coverCardList .card .ant-card-meta-description{height:44px;overflow:hidden;line-height:22px}.coverCardList .card:hover .ant-card-meta-title>a{color:#1890ff}.coverCardList .cardItemContent{display:flex;height:20px;margin-top:16px;margin-bottom:-4px;line-height:20px}.coverCardList .cardItemContent>span{flex:1;color:rgba(0,0,0,.45);font-size:12px}.coverCardList .cardItemContent .avatarList{flex:0 1 auto}.coverCardList .cardList{margin-top:24px}.coverCardList .ant-list .ant-list-item-content-single{max-width:100%}.numberInfo .suffix{margin-left:4px;color:rgba(0,0,0,.85);font-size:16px;font-style:normal}.numberInfo .numberInfoTitle{margin-bottom:16px;color:rgba(0,0,0,.85);font-size:16px;transition:all .3s}.numberInfo .numberInfoSubTitle{height:22px;overflow:hidden;color:rgba(0,0,0,.45);font-size:14px;line-height:22px;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.numberInfo .numberInfoValue{margin-top:4px;overflow:hidden;font-size:0;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.numberInfo .numberInfoValue>span{display:inline-block;height:32px;margin-right:32px;color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.numberInfo .numberInfoValue .subTotal{margin-right:0;color:rgba(0,0,0,.45);font-size:16px;vertical-align:top}.numberInfo .numberInfoValue .subTotal .anticon{margin-left:4px;font-size:12px;transform:scale(.82)}.numberInfo .numberInfoValue .subTotal :global .anticon-caret-up{color:#f5222d}.numberInfo .numberInfoValue .subTotal :global .anticon-caret-down{color:#52c41a}.numberInfolight .numberInfoValue>span{color:rgba(0,0,0,.85)}.trendItem{display:inline-block;font-size:14px;line-height:22px}.trendItem .down,.trendItem .up{position:relative;top:1px;margin-left:4px}.trendItem .down span,.trendItem .up span{font-size:12px;transform:scale(.83)}.trendItem .up{color:#f5222d}.trendItem .down{top:-1px;color:#52c41a}.trendItem.trendItemGrey .down,.trendItem.trendItemGrey .up{color:rgba(0,0,0,.85)}.trendItem.reverseColor .up{color:#52c41a}.trendItem.reverseColor .down{color:#f5222d}.activeChart{position:relative}.activeChartGrid p{position:absolute;top:80px}.activeChartGrid p:last-child{top:115px}.activeChartLegend{position:relative;height:20px;margin-top:8px;font-size:0;line-height:20px}.activeChartLegend span{display:inline-block;width:33.33%;font-size:12px;text-align:center}.activeChartLegend span:first-child{text-align:left}.activeChartLegend span:last-child{text-align:right}.dashedLine{position:relative;top:-70px;left:-3px;height:1px}.dashedLine .line{position:absolute;top:0;left:0;width:100%;height:100%;background-image:linear-gradient(to right,transparent 50%,#e9e9e9 50%);background-size:6px}.dashedLine:last-child{top:-36px}.linkGroup{padding:20px 0 8px 24px;font-size:0}.linkGroup>a{display:inline-block;width:25%;margin-bottom:13px;color:rgba(0,0,0,.85);font-size:14px}.linkGroup>a:hover{color:#1890ff}.radar .legend{margin-top:16px}.radar .legend .legendItem{position:relative;color:rgba(0,0,0,.45);line-height:22px;text-align:center;cursor:pointer}.radar .legend .legendItem p{margin:0}.radar .legend .legendItem h6{margin-top:4px;margin-bottom:0;padding-left:16px;color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.radar .legend .legendItem::after{position:absolute;top:8px;right:0;width:1px;height:40px;background-color:#f0f0f0;content:''}.radar .legend>:last-child .legendItem::after{display:none}.radar .legend .dot{position:relative;top:-1px;display:inline-block;width:6px;height:6px;margin-right:6px;border-radius:6px}.stepForm{max-width:500px;margin:40px auto 0}.stepFormText{margin-bottom:24px}.stepFormText :global .ant-form-item-control,.stepFormText :global .ant-form-item-label{line-height:22px}.result{max-width:560px;margin:0 auto;padding:24px 0 8px}.desc{padding:0 56px;color:rgba(0,0,0,.45)}.desc h3{margin:0 0 12px 0;color:rgba(0,0,0,.45);font-size:16px;line-height:32px}.desc h4{margin:0 0 4px 0;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.desc p{margin-top:0;margin-bottom:12px;line-height:22px}@media screen and (max-width:768px){.desc{padding:0}}.information{line-height:22px}.information :global .ant-row:not(:last-child){margin-bottom:24px}.information .label{padding-right:8px;color:rgba(0,0,0,.85);text-align:right}@media screen and (max-width:576px){.information .label{text-align:left}}.money{font-weight:500;font-size:20px;font-family:'Helvetica Neue',sans-serif;line-height:14px}.uppercase{font-size:12px}.stepForm{max-width:500px;margin:40px auto 0}.stepFormText{margin-bottom:24px}.stepFormText :global .ant-form-item-control,.stepFormText :global .ant-form-item-label{line-height:22px}.result{max-width:560px;margin:0 auto;padding:24px 0 8px}.desc{padding:0 56px;color:rgba(0,0,0,.45)}.desc h3{margin:0 0 12px 0;color:rgba(0,0,0,.45);font-size:16px;line-height:32px}.desc h4{margin:0 0 4px 0;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.desc p{margin-top:0;margin-bottom:12px;line-height:22px}@media screen and (max-width:768px){.desc{padding:0}}.information{line-height:22px}.information :global .ant-row:not(:last-child){margin-bottom:24px}.information .label{padding-right:8px;color:rgba(0,0,0,.85);text-align:right}@media screen and (max-width:576px){.information .label{text-align:left}}.money{font-weight:500;font-size:20px;font-family:'Helvetica Neue',sans-serif;line-height:14px}.uppercase{font-size:12px}.stepForm{max-width:500px;margin:40px auto 0}.stepFormText{margin-bottom:24px}.stepFormText :global .ant-form-item-control,.stepFormText :global .ant-form-item-label{line-height:22px}.result{max-width:560px;margin:0 auto;padding:24px 0 8px}.desc{padding:0 56px;color:rgba(0,0,0,.45)}.desc h3{margin:0 0 12px 0;color:rgba(0,0,0,.45);font-size:16px;line-height:32px}.desc h4{margin:0 0 4px 0;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.desc p{margin-top:0;margin-bottom:12px;line-height:22px}@media screen and (max-width:768px){.desc{padding:0}}.information{line-height:22px}.information :global .ant-row:not(:last-child){margin-bottom:24px}.information .label{padding-right:8px;color:rgba(0,0,0,.85);text-align:right}@media screen and (max-width:576px){.information .label{text-align:left}}.uppercase{font-size:12px}.field{margin:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.field .label,.field .number{font-size:14px;line-height:22px}.field .number{margin-left:8px;color:rgba(0,0,0,.85)}.chartCard{position:relative}.chartCard .chartTop{position:relative;width:100%;overflow:hidden}.chartCard .chartTopMargin{margin-bottom:12px}.chartCard .chartTopHasMargin{margin-bottom:20px}.chartCard .metaWrap{float:left}.chartCard .avatar{position:relative;top:4px;float:left;margin-right:20px}.chartCard .avatar img{border-radius:100%}.chartCard .meta{height:22px;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.chartCard .action{position:absolute;top:4px;right:0;line-height:1;cursor:pointer}.chartCard .total{height:38px;margin-top:4px;margin-bottom:0;overflow:hidden;color:rgba(0,0,0,.85);font-size:30px;line-height:38px;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.chartCard .content{position:relative;width:100%;margin-bottom:12px}.chartCard .contentFixed{position:absolute;bottom:0;left:0;width:100%}.chartCard .footer{margin-top:8px;padding-top:9px;border-top:1px solid #f0f0f0}.chartCard .footer>*{position:relative}.chartCard .footerMargin{margin-top:20px}.miniProgress{position:relative;width:100%;padding:5px 0}.miniProgress .progressWrap{position:relative;background-color:#f5f5f5}.miniProgress .progress{width:0;height:100%;background-color:#1890ff;border-radius:1px 0 0 1px;transition:all .4s cubic-bezier(.08,.82,.17,1) 0s}.miniProgress .target{position:absolute;top:0;bottom:0;z-index:9;width:20px}.miniProgress .target span{position:absolute;top:0;left:0;width:2px;height:4px;border-radius:100px}.miniProgress .target span:last-child{top:auto;bottom:0}.pie{position:relative}.pie .chart{position:relative}.pie.hasLegend .chart{width:calc(100% - 240px)}.pie .legend{position:absolute;top:50%;right:0;min-width:200px;margin:0 20px;padding:0;list-style:none;transform:translateY(-50%)}.pie .legend li{height:22px;margin-bottom:16px;line-height:22px;cursor:pointer}.pie .legend li:last-child{margin-bottom:0}.pie .dot{position:relative;top:-1px;display:inline-block;width:8px;height:8px;margin-right:8px;border-radius:8px}.pie .line{display:inline-block;width:1px;height:16px;margin-right:8px;background-color:#f0f0f0}.pie .legendTitle{color:rgba(0,0,0,.85)}.pie .percent{color:rgba(0,0,0,.45)}.pie .value{position:absolute;right:0}.pie .title{margin-bottom:8px}.pie .total{position:absolute;top:50%;left:50%;max-height:62px;text-align:center;transform:translate(-50%,-50%)}.pie .total>h4{height:22px;margin-bottom:8px;color:rgba(0,0,0,.45);font-weight:400;font-size:14px;line-height:22px}.pie .total>p{display:block;height:32px;color:rgba(0,0,0,.85);font-size:1.2em;line-height:32px;white-space:nowrap}.legendBlock.hasLegend .chart{width:100%;margin:0 0 32px 0}.legendBlock .legend{position:relative;transform:none}.tagCloud{overflow:hidden}.tagCloud canvas{transform-origin:0 0}.timelineChart{background:#fff}.waterWave{position:relative;display:inline-block;transform-origin:left}.waterWave .text{position:absolute;top:32px;left:0;width:100%;text-align:center}.waterWave .text span{color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.waterWave .text h4{color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.waterWave .waterWaveCanvasWrapper{transform:scale(.5);transform-origin:0 0}.standardFormRow{display:flex;width:100%;margin-bottom:16px;padding-bottom:16px;border-bottom:1px dashed #f0f0f0}.standardFormRow .ant-form-item,.standardFormRow .ant-legacy-form-item{margin-right:24px}.standardFormRow .ant-form-item-label label,.standardFormRow .ant-legacy-form-item-label label{margin-right:0;color:rgba(0,0,0,.85)}.standardFormRow .ant-form-item-control,.standardFormRow .ant-form-item-label,.standardFormRow .ant-legacy-form-item-control,.standardFormRow .ant-legacy-form-item-label{padding:0;line-height:32px}.standardFormRow .label{flex:0 0 auto;margin-right:24px;color:rgba(0,0,0,.85);font-size:14px;text-align:right}.standardFormRow .label>span{display:inline-block;height:32px;line-height:32px}.standardFormRow .label>span::after{content:':'}.standardFormRow .content{flex:1 1 0}.standardFormRow .content :global .ant-form-item:last-child,.standardFormRow .content :global .ant-legacy-form-item:last-child{display:block;margin-right:0}.standardFormRowLast{margin-bottom:0;padding-bottom:0;border:none}.standardFormRowBlock :global .ant-form-item,.standardFormRowBlock :global .ant-legacy-form-item,.standardFormRowBlock :global div.ant-form-item-control-wrapper,.standardFormRowBlock :global div.ant-legacy-form-item-control-wrapper{display:block}.standardFormRowGrid .ant-form-item,.standardFormRowGrid .ant-legacy-form-item,.standardFormRowGrid div.ant-form-item-control-wrapper,.standardFormRowGrid div.ant-legacy-form-item-control-wrapper{display:block}.standardFormRowGrid .ant-form-item-label,.standardFormRowGrid .ant-legacy-form-item-label{float:left}.tagSelect{position:relative;max-height:32px;margin-left:-8px;overflow:hidden;line-height:32px;transition:all .3s;user-select:none}.tagSelect .ant-tag{margin-right:24px;padding:0 8px;font-size:14px}.tagSelect.expanded{max-height:200px;transition:all .3s}.tagSelect .trigger{position:absolute;top:0;right:0}.tagSelect .trigger span.anticon{font-size:12px}.tagSelect.hasExpandTag{padding-right:50px} \ No newline at end of file +.container__b__0{display:flex;flex-direction:column;height:100vh;overflow:auto;background:#f0f2f5}.container__b__0 .lang{width:100%;height:40px;line-height:44px;text-align:right}.container__b__0 .lang :global(.ant-dropdown-trigger){margin-right:24px}.container__b__0 .content{flex:1;padding:32px 0}.container__b__0 .top{text-align:center}.container__b__0 .header{height:44px;line-height:44px}.container__b__0 .header a{text-decoration:none}.container__b__0 .logo{height:44px;margin-right:16px;vertical-align:top}.container__b__0 .title{position:relative;top:2px;color:rgba(0,0,0,.85);font-weight:600;font-size:33px;font-family:Avenir,'Helvetica Neue',Arial,Helvetica,sans-serif}.container__b__0 .desc{margin-top:12px;margin-bottom:40px;color:rgba(0,0,0,.45);font-size:14px}@media (min-width:768px){.container__b__0{background-image:url(https://gw.alipayobjects.com/zos/rmsportal/TVYTbAXWheQpRcWDaDMu.svg);background-repeat:no-repeat;background-position:center 110px;background-size:100%}.container__b__0 .content{padding:32px 0 24px}}#app,#root,app,body,html{height:100%}.colorWeak{filter:invert(80%)}.ant-layout{min-height:100vh}canvas{display:block}body{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}ol,ul{list-style:none}@media (max-width:480px){.ant-table{width:100%;overflow-x:auto}.ant-table-tbody>tr>td,.ant-table-tbody>tr>th,.ant-table-thead>tr>td,.ant-table-thead>tr>th{white-space:pre}.ant-table-tbody>tr>td>span,.ant-table-tbody>tr>th>span,.ant-table-thead>tr>td>span,.ant-table-thead>tr>th>span{display:block}}@media screen and (-ms-high-contrast:active),(-ms-high-contrast:none){body .ant-design-pro>.ant-layout{min-height:100vh}}.avatarHolder{margin-bottom:24px;text-align:center}.avatarHolder>img{width:104px;height:104px;margin-bottom:20px}.avatarHolder .name{margin-bottom:4px;color:rgba(0,0,0,.85);font-weight:500;font-size:20px;line-height:28px}.detail p{position:relative;margin-bottom:8px;padding-left:26px}.detail p:last-child{margin-bottom:0}.detail i{position:absolute;top:4px;left:0;width:14px;height:14px}.tagsTitle,.teamTitle{margin-bottom:12px;color:rgba(0,0,0,.85);font-weight:500}.tags .ant-tag{margin-bottom:8px}.team .ant-avatar{margin-right:12px}.team a{display:block;margin-bottom:24px;overflow:hidden;color:rgba(0,0,0,.85);white-space:nowrap;text-overflow:ellipsis;word-break:break-all;transition:color .3s}.team a:hover{color:#1890ff}.tabsCard .ant-card-head{padding:0 16px}.main__b__2{display:flex;width:100%;height:100%;padding-top:16px;padding-bottom:16px;overflow:auto;background-color:#fff}.main__b__2 .leftMenu{width:224px;border-right:1px solid #f0f0f0}.main__b__2 .leftMenu :global .ant-menu-inline{border:none}.main__b__2 .leftMenu :global .ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected{font-weight:700}.main__b__2 .right__b__0{flex:1;padding-top:8px;padding-right:40px;padding-bottom:8px;padding-left:40px}.main__b__2 .right__b__0 .title{margin-bottom:12px;color:rgba(0,0,0,.85);font-weight:500;font-size:20px;line-height:28px}.main__b__2 .ant-list-split .ant-list-item:last-child{border-bottom:1px solid #f0f0f0}.main__b__2 .ant-list-item{padding-top:14px;padding-bottom:14px}.ant-list-item-meta .taobao{display:block;color:#ff4000;font-size:48px;line-height:48px;border-radius:2px}.ant-list-item-meta .dingding{margin:2px;padding:6px;color:#fff;font-size:32px;line-height:32px;background-color:#2eabff;border-radius:2px}.ant-list-item-meta .alipay{color:#2eabff;font-size:48px;line-height:48px;border-radius:2px}font.strong{color:#52c41a}font.medium{color:#faad14}font.weak{color:#ff4d4f}@media screen and (max-width:768px){.main__b__2{flex-direction:column}.main__b__2 .leftMenu{width:100%;border:none}.main__b__2 .right__b__0{padding:40px}}.iconGroup span.anticon{margin-left:16px;color:rgba(0,0,0,.45);cursor:pointer;transition:color .32s}.iconGroup span.anticon:hover{color:rgba(0,0,0,.85)}.rankingList{margin:25px 0 0;padding:0;list-style:none}.rankingList li{display:flex;align-items:center;margin-top:16px;zoom:1}.rankingList li::after,.rankingList li::before{display:table;content:' '}.rankingList li::after{clear:both;height:0;font-size:0;visibility:hidden}.rankingList li span{color:rgba(0,0,0,.85);font-size:14px;line-height:22px}.rankingList li .rankingItemNumber{display:inline-block;width:20px;height:20px;margin-top:1.5px;margin-right:16px;font-weight:600;font-size:12px;line-height:20px;text-align:center;background-color:#fafafa;border-radius:20px}.rankingList li .rankingItemNumber.active{color:#fff;background-color:#314659}.rankingList li .rankingItemTitle{flex:1;margin-right:8px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.salesExtra{display:inline-block;margin-right:24px}.salesExtra a{margin-left:24px;color:rgba(0,0,0,.85)}.salesExtra a:hover{color:#1890ff}.salesExtra a.currentDate{color:#1890ff}.salesCard .salesBar{padding:0 0 32px 32px}.salesCard .salesRank{padding:0 32px 32px 72px}.salesCard :global .ant-tabs-bar,.salesCard :global .ant-tabs-nav-wrap{padding-left:16px}.salesCard :global .ant-tabs-bar .ant-tabs-nav .ant-tabs-tab,.salesCard :global .ant-tabs-nav-wrap .ant-tabs-nav .ant-tabs-tab{padding-top:16px;padding-bottom:14px;line-height:24px}.salesCard :global .ant-tabs-extra-content{padding-right:24px;line-height:55px}.salesCard :global .ant-card-head{position:relative}.salesCard :global .ant-card-head-title{align-items:normal}.salesCardExtra{height:inherit}.salesTypeRadio{position:absolute;right:54px;bottom:12px}.offlineCard :global .ant-tabs-ink-bar{bottom:auto}.offlineCard :global .ant-tabs-bar{border-bottom:none}.offlineCard :global .ant-tabs-nav-container-scrolling{padding-right:40px;padding-left:40px}.offlineCard :global .ant-tabs-tab-prev-icon::before{position:relative;left:6px}.offlineCard :global .ant-tabs-tab-next-icon::before{position:relative;right:6px}.offlineCard :global .ant-tabs-tab-active h4{color:#1890ff}.trendText{margin-left:8px;color:rgba(0,0,0,.85)}@media screen and (max-width:992px){.salesExtra{display:none}.rankingList li span:first-child{margin-right:8px}}@media screen and (max-width:768px){.rankingTitle{margin-top:16px}.salesCard .salesBar{padding:16px}}@media screen and (max-width:576px){.salesExtraWrap{display:none}.salesCard :global .ant-tabs-content{padding-top:30px}}.mapChart{height:452px;padding-top:24px}.mapChart img{display:inline-block;max-width:100%;max-height:437px}.pieCard :global(.pie-stat){font-size:24px!important}@media screen and (max-width:992px){.mapChart{height:auto}}.activitiesList{padding:0 24px 8px 24px}.activitiesList .username{color:rgba(0,0,0,.85)}.activitiesList .event{font-weight:400}.pageHeaderContent__b__0{display:flex}.pageHeaderContent__b__0 .avatar{flex:0 1 72px}.pageHeaderContent__b__0 .avatar>span{display:block;width:72px;height:72px;border-radius:72px}.pageHeaderContent__b__0 .content{position:relative;top:4px;flex:1 1 auto;margin-left:24px;color:rgba(0,0,0,.45);line-height:22px}.pageHeaderContent__b__0 .content .contentTitle{margin-bottom:12px;color:rgba(0,0,0,.85);font-weight:500;font-size:20px;line-height:28px}.extraContent{zoom:1;float:right;white-space:nowrap}.extraContent::after,.extraContent::before{display:table;content:' '}.extraContent::after{clear:both;height:0;font-size:0;visibility:hidden}.extraContent .statItem{position:relative;display:inline-block;padding:0 32px}.extraContent .statItem>p:first-child{margin-bottom:4px;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.extraContent .statItem>p{margin:0;color:rgba(0,0,0,.85);font-size:30px;line-height:38px}.extraContent .statItem>p>span{color:rgba(0,0,0,.45);font-size:20px}.extraContent .statItem::after{position:absolute;top:8px;right:0;width:1px;height:40px;background-color:#f0f0f0;content:''}.extraContent .statItem:last-child{padding-right:0}.extraContent .statItem:last-child::after{display:none}.members a{display:block;height:24px;margin:12px 0;color:rgba(0,0,0,.85);transition:all .3s;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.members a .member{margin-left:12px;font-size:14px;line-height:24px;vertical-align:top}.members a:hover{color:#1890ff}.projectList .ant-card-meta-description{height:44px;overflow:hidden;color:rgba(0,0,0,.45);line-height:22px}.projectList .cardTitle{font-size:0}.projectList .cardTitle a{display:inline-block;height:24px;margin-left:12px;color:rgba(0,0,0,.85);font-size:14px;line-height:24px;vertical-align:top}.projectList .cardTitle a:hover{color:#1890ff}.projectList .projectGrid{width:33.33%}.projectList .projectItemContent{display:flex;height:20px;margin-top:8px;font-size:12px;line-height:20px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.projectList .projectItemContent a{display:inline-block;flex:1 1 0;color:rgba(0,0,0,.45);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.projectList .projectItemContent a:hover{color:#1890ff}.projectList .projectItemContent .datetime{flex:0 0 auto;float:right;color:rgba(0,0,0,.25)}.datetime{color:rgba(0,0,0,.25)}@media screen and (max-width:1200px) and (min-width:992px){.activeCard{margin-bottom:24px}.members{margin-bottom:0}.extraContent{margin-left:-44px}.extraContent .statItem{padding:0 16px}}@media screen and (max-width:992px){.activeCard{margin-bottom:24px}.members{margin-bottom:0}.extraContent{float:none;margin-right:0}.extraContent .statItem{padding:0 16px;text-align:left}.extraContent .statItem::after{display:none}}@media screen and (max-width:768px){.extraContent{margin-left:-16px}.projectList .projectGrid{width:50%}}@media screen and (max-width:576px){.pageHeaderContent{display:block}.pageHeaderContent .content{margin-left:0}.extraContent .statItem{float:none}}@media screen and (max-width:480px){.projectList .projectGrid{width:100%}}.card{margin-bottom:24px}.card :global .ant-legacy-form-item .ant-legacy-form-item-control-wrapper{width:100%}.errorIcon{margin-right:24px;color:#ff4d4f;cursor:pointer}.errorIcon span.anticon{margin-right:4px}.errorPopover :global .ant-popover-inner-content{min-width:256px;max-height:290px;padding:0;overflow:auto}.errorListItem{padding:8px 16px;list-style:none;border-bottom:1px solid #f0f0f0;cursor:pointer;transition:all .3s}.errorListItem:hover{background:#e6f7ff}.errorListItem:last-child{border:0}.errorListItem .errorIcon{float:left;margin-top:4px;margin-right:12px;padding-bottom:22px;color:#ff4d4f}.errorListItem .errorField{margin-top:2px;color:rgba(0,0,0,.45);font-size:12px}.editable td{padding-top:13px!important;padding-bottom:12.5px!important}.card{margin-bottom:24px}.card :global .ant-legacy-form-item .ant-legacy-form-item-control-wrapper{width:100%}.errorIcon{margin-right:24px;color:#ff4d4f;cursor:pointer}.errorIcon span.anticon{margin-right:4px}.errorPopover :global .ant-popover-inner-content{min-width:256px;max-height:290px;padding:0;overflow:auto}.errorListItem{padding:8px 16px;list-style:none;border-bottom:1px solid #f0f0f0;cursor:pointer;transition:all .3s}.errorListItem:hover{background:#e6f7ff}.errorListItem:last-child{border:0}.errorListItem .errorIcon{float:left;margin-top:4px;margin-right:12px;padding-bottom:22px;color:#ff4d4f}.errorListItem .errorField{margin-top:2px;color:rgba(0,0,0,.45);font-size:12px}.editable td{padding-top:13px!important;padding-bottom:12.5px!important}.card{margin-bottom:24px}.heading{margin:0 0 16px 0;font-size:14px;line-height:22px}.steps.ant-steps{max-width:750px;margin:16px auto}.errorIcon{margin-right:24px;color:#ff4d4f;cursor:pointer}.errorIcon span.anticon{margin-right:4px}.errorPopover :global .ant-popover-inner-content{min-width:256px;max-height:290px;padding:0;overflow:auto}.errorListItem{padding:8px 16px;list-style:none;border-bottom:1px solid #f0f0f0;cursor:pointer;transition:all .3s}.errorListItem:hover{background:#e6f7ff}.errorListItem:last-child{border:0}.errorListItem .errorIcon{float:left;margin-top:4px;margin-right:12px;padding-bottom:22px;color:#ff4d4f}.errorListItem .errorField{margin-top:2px;color:rgba(0,0,0,.45);font-size:12px}.editable td{padding-top:13px!important;padding-bottom:12.5px!important}.advancedForm+div{padding-bottom:64px}.advancedForm :global .ant-form .ant-row:last-child .ant-form-item{margin-bottom:24px}.advancedForm :global .ant-table td{transition:none!important}.optional{color:rgba(0,0,0,.45);font-style:normal}.standardList .ant-card-head{border-bottom:none}.standardList .ant-card-head-title{padding:24px 0;line-height:32px}.standardList .ant-card-extra{padding:24px 0}.standardList .ant-list-pagination{margin-top:24px;text-align:right}.standardList .ant-avatar-lg{width:48px;height:48px;line-height:48px}.standardList .headerInfo{position:relative;text-align:center}.standardList .headerInfo>span{display:inline-block;margin-bottom:4px;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.standardList .headerInfo>p{margin:0;color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.standardList .headerInfo>em{position:absolute;top:0;right:0;width:1px;height:56px;background-color:#f0f0f0}.standardList .listContent{font-size:0}.standardList .listContent .listContentItem{display:inline-block;margin-left:40px;color:rgba(0,0,0,.45);font-size:14px;vertical-align:middle}.standardList .listContent .listContentItem>span{line-height:20px}.standardList .listContent .listContentItem>p{margin-top:4px;margin-bottom:0;line-height:22px}.standardList .extraContentSearch{width:272px;margin-left:16px}@media screen and (max-width:480px){.standardList .ant-list-item-content{display:block;flex:none;width:100%}.standardList .ant-list-item-action{margin-left:0}.standardList .listContent{margin-left:0}.standardList .listContent>div{margin-left:0}.standardList .listCard .ant-card-head-title{overflow:visible}}@media screen and (max-width:576px){.standardList .extraContentSearch{width:100%;margin-left:0}.standardList .headerInfo{margin-bottom:16px}.standardList .headerInfo>em{display:none}}@media screen and (max-width:768px){.standardList .listContent>div{display:block}.standardList .listContent>div:last-child{top:0;width:100%}.listCard .ant-radio-group{display:block;margin-bottom:8px}}@media screen and (max-width:992px) and (min-width:768px){.standardList .listContent>div{display:block}.standardList .listContent>div:last-child{top:0;width:100%}}@media screen and (max-width:1200px){.standardList .listContent>div{margin-left:24px}.standardList .listContent>div:last-child{top:0}}@media screen and (max-width:1400px){.standardList .listContent{text-align:right}.standardList .listContent>div:last-child{top:0}}.standardListForm .ant-form-item{margin-bottom:12px}.standardListForm .ant-form-item:last-child{margin-bottom:32px;padding-top:4px}.formResult{width:100%}.formResult [class^=title]{margin-bottom:8px}.cardList .card .ant-card-meta-title{margin-bottom:12px}.cardList .card .ant-card-meta-title>a{display:inline-block;max-width:100%;color:rgba(0,0,0,.85)}.cardList .card .ant-card-body:hover .ant-card-meta-title>a{color:#1890ff}.cardList .item{height:64px}.cardList .ant-list .ant-list-item-content-single{max-width:100%}.extraImg{width:155px;margin-top:-20px;text-align:center}.extraImg img{width:100%}.newButton{width:100%;height:201px;color:rgba(0,0,0,.45);background-color:#fff;border-color:#d9d9d9}.cardAvatar{width:48px;height:48px;border-radius:48px}.cardDescription{position:relative;max-height:4.5em;margin-right:-1em;padding-right:1em;overflow:hidden;line-height:1.5em;text-align:justify}.cardDescription::before{position:absolute;right:14px;bottom:0;padding:0 1px;background:#fff;content:'...'}.cardDescription::after{position:absolute;right:14px;width:1em;height:1em;margin-top:.2em;background:#fff;content:''}.pageHeaderContent__b__1{position:relative}.contentLink{margin-top:16px}.contentLink a{margin-right:32px}.contentLink a img{width:24px}.contentLink img{margin-right:8px;vertical-align:middle}@media screen and (max-width:992px){.contentLink a{margin-right:16px}}@media screen and (max-width:768px){.extraImg{display:none}}@media screen and (max-width:576px){.pageHeaderContent__b__1{padding-bottom:30px}.contentLink{position:absolute;bottom:-4px;left:0;width:1000px}.contentLink a{margin-right:16px}.contentLink img{margin-right:4px}}.main__b__3 .ant-descriptions-row>td{padding-bottom:8px}.main__b__3 .ant-page-header-heading-extra{flex-direction:column}.headerList{margin-bottom:4px}.headerList .ant-descriptions-row>td{padding-bottom:8px}.headerList .stepDescription{position:relative;left:38px;padding-top:8px;font-size:14px;text-align:left}.headerList .stepDescription>div{margin-top:8px;margin-bottom:4px}.pageHeader .ant-page-header-heading-extra>*+*{margin-left:8px}.pageHeader .moreInfo{display:flex;justify-content:space-between;width:200px}@media screen and (max-width:576px){.stepDescription{left:8px}.pageHeader .ant-pro-page-header-wrap-row{flex-direction:column}}.title{margin-bottom:16px;color:rgba(0,0,0,.85);font-weight:500;font-size:16px}.error_icon{color:#ff4d4f}.title__b__0{margin-bottom:16px;color:rgba(0,0,0,.85);font-weight:500;font-size:16px}.title__b__1{position:relative;color:rgba(0,0,0,.85);font-size:12px;text-align:center}.head-title{margin-bottom:20px;color:rgba(0,0,0,.85);font-weight:500px;font-size:16px}.main__b__0{width:368px;margin:0 auto}@media screen and (max-width:576px){.main__b__0{width:95%}}.main__b__0 .login :global .ant-tabs .ant-tabs-bar{margin-bottom:24px;text-align:center;border-bottom:0}.main__b__0 .login .getCaptcha{display:block;width:100%}.main__b__0 .login .icon{color:#1890ff}.main__b__0 .login .other{margin-top:24px;line-height:22px;text-align:left}.main__b__0 .login .other .icon{margin-left:16px;color:rgba(0,0,0,.45);font-size:24px;vertical-align:middle;cursor:pointer;transition:color .3s}.main__b__0 .login .other .icon:hover{color:#1890ff}.main__b__0 .login .other .register{float:right}.main__b__0 .login .prefixIcon{color:rgba(0,0,0,.25);font-size:14px}.main__b__0 .login .submit{width:100%;margin-top:24px}.main__b__1{width:368px;margin:0 auto}.main__b__1 h3{margin-bottom:20px;font-size:16px}.main__b__1 .password{margin-bottom:24px}.main__b__1 .password :global .ant-form-item-explain{display:none}.main__b__1 .getCaptcha{display:block;width:100%}.main__b__1 .submit{width:50%}.main__b__1 .login{float:right;line-height:40px}.error,.success,.warning{transition:color .3s}.success{color:#52c41a}.warning{color:#faad14}.error{color:#ff4d4f}.progress-pass>.progress :global .ant-progress-bg{background-color:#faad14}.registerResult{width:800px;min-height:400px;margin:auto;padding:80px;background:0 0}.registerResult :global .anticon{font-size:64px}.registerResult .title{margin-top:32px;font-size:20px;line-height:28px}.registerResult .actions{margin-top:40px}.registerResult .actions a+a{margin-left:8px}.baseView{display:flex;padding-top:12px}.baseView :global .ant-legacy-form-item .ant-legacy-form-item-control-wrapper{width:100%}.baseView .left{min-width:224px;max-width:448px}.baseView .right__b__1{flex:1;padding-left:104px}.baseView .right__b__1 .avatar_title{height:22px;margin-bottom:8px;color:rgba(0,0,0,.85);font-size:14px;line-height:22px}.baseView .right__b__1 .avatar{width:144px;height:144px;margin-bottom:12px;overflow:hidden}.baseView .right__b__1 .avatar img{width:100%}.baseView .right__b__1 .button_view{width:144px;text-align:center}@media screen and (max-width:1200px){.baseView{flex-direction:column-reverse}.baseView .right__b__1{display:flex;flex-direction:column;align-items:center;max-width:448px;padding:20px}.baseView .right__b__1 .avatar_title{display:none}}.row .item{width:50%;max-width:220px}.row .item:first-child{width:calc(50% - 8px);margin-right:8px}@media screen and (max-width:576px){.item:first-child{margin:0;margin-bottom:8px}}.area_code{width:30%;max-width:128px;margin-right:8px}.phone_number{width:calc(70% - 8px);max-width:312px}.filterCardList .ant-card-meta-content{margin-top:0}.filterCardList .ant-card-meta-avatar{font-size:0}.filterCardList .ant-list .ant-list-item-content-single{max-width:100%}.filterCardList .cardInfo{margin-top:16px;margin-left:40px;zoom:1}.filterCardList .cardInfo::after,.filterCardList .cardInfo::before{display:table;content:' '}.filterCardList .cardInfo::after{clear:both;height:0;font-size:0;visibility:hidden}.filterCardList .cardInfo>div{position:relative;float:left;width:50%;text-align:left}.filterCardList .cardInfo>div p{margin:0;font-size:24px;line-height:32px}.filterCardList .cardInfo>div p:first-child{margin-bottom:4px;color:rgba(0,0,0,.45);font-size:12px;line-height:20px}a.listItemMetaTitle{color:rgba(0,0,0,.85)}.listItemExtra{width:272px;height:1px}.selfTrigger{margin-left:12px}@media screen and (max-width:480px){.selfTrigger{display:block;margin-left:0}}@media screen and (max-width:768px){.selfTrigger{display:block;margin-left:0}}@media screen and (max-width:992px){.listItemExtra{width:0;height:1px}}.filterCardList{margin-bottom:-24px}.filterCardList :global .ant-card-meta-content{margin-top:0}.filterCardList :global .ant-card-meta-avatar{font-size:0}.filterCardList :global .ant-list .ant-list-item-content-single{max-width:100%}.filterCardList .cardInfo{margin-top:16px;margin-left:40px;zoom:1}.filterCardList .cardInfo::after,.filterCardList .cardInfo::before{display:table;content:' '}.filterCardList .cardInfo::after{clear:both;height:0;font-size:0;visibility:hidden}.filterCardList .cardInfo>div{position:relative;float:left;width:50%;text-align:left}.filterCardList .cardInfo>div p{margin:0;font-size:24px;line-height:32px}.filterCardList .cardInfo>div p:first-child{margin-bottom:4px;color:rgba(0,0,0,.45);font-size:12px;line-height:20px}.listContent .description{max-width:720px;line-height:22px}.listContent .extra{margin-top:16px;color:rgba(0,0,0,.45);line-height:22px}.listContent .extra>:global(.ant-avatar){position:relative;top:1px;width:20px;height:20px;margin-right:8px;vertical-align:top}.listContent .extra>em{margin-left:16px;color:rgba(0,0,0,.25);font-style:normal}@media screen and (max-width:480px){.listContent .extra>em{display:block;margin-top:8px;margin-left:0}}.articleList :global .ant-list-item:first-child{padding-top:0}a.listItemMetaTitle{color:rgba(0,0,0,.85)}.avatarList{display:inline-block}.avatarList ul{display:inline-block;margin-left:8px;font-size:0}.avatarItem{display:inline-block;width:32px;height:32px;margin-left:-8px;font-size:14px}.avatarItem :global .ant-avatar{border:1px solid #d9d9d9}.avatarItemLarge{width:40px;height:40px}.avatarItemSmall{width:24px;height:24px}.avatarItemMini{width:20px;height:20px}.avatarItemMini :global .ant-avatar{width:20px;height:20px;line-height:20px}.avatarItemMini :global .ant-avatar .ant-avatar-string{font-size:12px;line-height:18px}.coverCardList .card .ant-card-meta-title{margin-bottom:4px}.coverCardList .card .ant-card-meta-title>a{display:inline-block;max-width:100%;color:rgba(0,0,0,.85)}.coverCardList .card .ant-card-meta-description{height:44px;overflow:hidden;line-height:22px}.coverCardList .card:hover .ant-card-meta-title>a{color:#1890ff}.coverCardList .cardItemContent{display:flex;height:20px;margin-top:16px;margin-bottom:-4px;line-height:20px}.coverCardList .cardItemContent>span{flex:1;color:rgba(0,0,0,.45);font-size:12px}.coverCardList .cardItemContent .avatarList{flex:0 1 auto}.coverCardList .cardList{margin-top:24px}.coverCardList .ant-list .ant-list-item-content-single{max-width:100%}.numberInfo .suffix{margin-left:4px;color:rgba(0,0,0,.85);font-size:16px;font-style:normal}.numberInfo .numberInfoTitle{margin-bottom:16px;color:rgba(0,0,0,.85);font-size:16px;transition:all .3s}.numberInfo .numberInfoSubTitle{height:22px;overflow:hidden;color:rgba(0,0,0,.45);font-size:14px;line-height:22px;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.numberInfo .numberInfoValue{margin-top:4px;overflow:hidden;font-size:0;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.numberInfo .numberInfoValue>span{display:inline-block;height:32px;margin-right:32px;color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.numberInfo .numberInfoValue .subTotal{margin-right:0;color:rgba(0,0,0,.45);font-size:16px;vertical-align:top}.numberInfo .numberInfoValue .subTotal .anticon{margin-left:4px;font-size:12px;transform:scale(.82)}.numberInfo .numberInfoValue .subTotal :global .anticon-caret-up{color:#f5222d}.numberInfo .numberInfoValue .subTotal :global .anticon-caret-down{color:#52c41a}.numberInfolight .numberInfoValue>span{color:rgba(0,0,0,.85)}.miniChart{position:relative;width:100%}.miniChart .chartContent{position:absolute;bottom:-28px;width:100%}.miniChart .chartContent>div{margin:0 -5px;overflow:hidden}.miniChart .chartLoading{position:absolute;top:16px;left:50%;margin-left:-7px}.activeChart{position:relative}.activeChartGrid p{position:absolute;top:80px}.activeChartGrid p:last-child{top:115px}.activeChartLegend{position:relative;height:20px;margin-top:8px;font-size:0;line-height:20px}.activeChartLegend span{display:inline-block;width:33.33%;font-size:12px;text-align:center}.activeChartLegend span:first-child{text-align:left}.activeChartLegend span:last-child{text-align:right}.dashedLine{position:relative;top:-70px;left:-3px;height:1px}.dashedLine .line{position:absolute;top:0;left:0;width:100%;height:100%;background-image:linear-gradient(to right,transparent 50%,#e9e9e9 50%);background-size:6px}.dashedLine:last-child{top:-36px}.trendItem{display:inline-block;font-size:14px;line-height:22px}.trendItem .down,.trendItem .up{position:relative;top:1px;margin-left:4px}.trendItem .down span,.trendItem .up span{font-size:12px;transform:scale(.83)}.trendItem .up{color:#f5222d}.trendItem .down{top:-1px;color:#52c41a}.trendItem.trendItemGrey .down,.trendItem.trendItemGrey .up{color:rgba(0,0,0,.85)}.trendItem.reverseColor .up{color:#52c41a}.trendItem.reverseColor .down{color:#f5222d}.linkGroup{padding:20px 0 8px 24px;font-size:0}.linkGroup>a{display:inline-block;width:25%;margin-bottom:13px;color:rgba(0,0,0,.85);font-size:14px}.linkGroup>a:hover{color:#1890ff}.stepForm{max-width:500px;margin:40px auto 0}.stepFormText{margin-bottom:24px}.stepFormText :global .ant-form-item-control,.stepFormText :global .ant-form-item-label{line-height:22px}.result{max-width:560px;margin:0 auto;padding:24px 0 8px}.desc{padding:0 56px;color:rgba(0,0,0,.45)}.desc h3{margin:0 0 12px 0;color:rgba(0,0,0,.45);font-size:16px;line-height:32px}.desc h4{margin:0 0 4px 0;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.desc p{margin-top:0;margin-bottom:12px;line-height:22px}@media screen and (max-width:768px){.desc{padding:0}}.information{line-height:22px}.information :global .ant-row:not(:last-child){margin-bottom:24px}.information .label{padding-right:8px;color:rgba(0,0,0,.85);text-align:right}@media screen and (max-width:576px){.information .label{text-align:left}}.money{font-weight:500;font-size:20px;font-family:'Helvetica Neue',sans-serif;line-height:14px}.uppercase{font-size:12px}.radar .legend{margin-top:16px}.radar .legend .legendItem{position:relative;color:rgba(0,0,0,.45);line-height:22px;text-align:center;cursor:pointer}.radar .legend .legendItem p{margin:0}.radar .legend .legendItem h6{margin-top:4px;margin-bottom:0;padding-left:16px;color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.radar .legend .legendItem::after{position:absolute;top:8px;right:0;width:1px;height:40px;background-color:#f0f0f0;content:''}.radar .legend>:last-child .legendItem::after{display:none}.radar .legend .dot{position:relative;top:-1px;display:inline-block;width:6px;height:6px;margin-right:6px;border-radius:6px}.stepForm{max-width:500px;margin:40px auto 0}.stepFormText{margin-bottom:24px}.stepFormText :global .ant-form-item-control,.stepFormText :global .ant-form-item-label{line-height:22px}.result{max-width:560px;margin:0 auto;padding:24px 0 8px}.desc{padding:0 56px;color:rgba(0,0,0,.45)}.desc h3{margin:0 0 12px 0;color:rgba(0,0,0,.45);font-size:16px;line-height:32px}.desc h4{margin:0 0 4px 0;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.desc p{margin-top:0;margin-bottom:12px;line-height:22px}@media screen and (max-width:768px){.desc{padding:0}}.information{line-height:22px}.information :global .ant-row:not(:last-child){margin-bottom:24px}.information .label{padding-right:8px;color:rgba(0,0,0,.85);text-align:right}@media screen and (max-width:576px){.information .label{text-align:left}}.money{font-weight:500;font-size:20px;font-family:'Helvetica Neue',sans-serif;line-height:14px}.uppercase{font-size:12px}.stepForm{max-width:500px;margin:40px auto 0}.stepFormText{margin-bottom:24px}.stepFormText :global .ant-form-item-control,.stepFormText :global .ant-form-item-label{line-height:22px}.result{max-width:560px;margin:0 auto;padding:24px 0 8px}.desc{padding:0 56px;color:rgba(0,0,0,.45)}.desc h3{margin:0 0 12px 0;color:rgba(0,0,0,.45);font-size:16px;line-height:32px}.desc h4{margin:0 0 4px 0;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.desc p{margin-top:0;margin-bottom:12px;line-height:22px}@media screen and (max-width:768px){.desc{padding:0}}.information{line-height:22px}.information :global .ant-row:not(:last-child){margin-bottom:24px}.information .label{padding-right:8px;color:rgba(0,0,0,.85);text-align:right}@media screen and (max-width:576px){.information .label{text-align:left}}.uppercase{font-size:12px}.chartCard{position:relative}.chartCard .chartTop{position:relative;width:100%;overflow:hidden}.chartCard .chartTopMargin{margin-bottom:12px}.chartCard .chartTopHasMargin{margin-bottom:20px}.chartCard .metaWrap{float:left}.chartCard .avatar{position:relative;top:4px;float:left;margin-right:20px}.chartCard .avatar img{border-radius:100%}.chartCard .meta{height:22px;color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.chartCard .action{position:absolute;top:4px;right:0;line-height:1;cursor:pointer}.chartCard .total{height:38px;margin-top:4px;margin-bottom:0;overflow:hidden;color:rgba(0,0,0,.85);font-size:30px;line-height:38px;white-space:nowrap;text-overflow:ellipsis;word-break:break-all}.chartCard .content{position:relative;width:100%;margin-bottom:12px}.chartCard .contentFixed{position:absolute;bottom:0;left:0;width:100%}.chartCard .footer{margin-top:8px;padding-top:9px;border-top:1px solid #f0f0f0}.chartCard .footer>*{position:relative}.chartCard .footerMargin{margin-top:20px}.field{margin:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.field .label,.field .number{font-size:14px;line-height:22px}.field .number{margin-left:8px;color:rgba(0,0,0,.85)}.miniProgress{position:relative;width:100%;padding:5px 0}.miniProgress .progressWrap{position:relative;background-color:#f5f5f5}.miniProgress .progress{width:0;height:100%;background-color:#1890ff;border-radius:1px 0 0 1px;transition:all .4s cubic-bezier(.08,.82,.17,1) 0s}.miniProgress .target{position:absolute;top:0;bottom:0;z-index:9;width:20px}.miniProgress .target span{position:absolute;top:0;left:0;width:2px;height:4px;border-radius:100px}.miniProgress .target span:last-child{top:auto;bottom:0}.pie{position:relative}.pie .chart{position:relative}.pie.hasLegend .chart{width:calc(100% - 240px)}.pie .legend{position:absolute;top:50%;right:0;min-width:200px;margin:0 20px;padding:0;list-style:none;transform:translateY(-50%)}.pie .legend li{height:22px;margin-bottom:16px;line-height:22px;cursor:pointer}.pie .legend li:last-child{margin-bottom:0}.pie .dot{position:relative;top:-1px;display:inline-block;width:8px;height:8px;margin-right:8px;border-radius:8px}.pie .line{display:inline-block;width:1px;height:16px;margin-right:8px;background-color:#f0f0f0}.pie .legendTitle{color:rgba(0,0,0,.85)}.pie .percent{color:rgba(0,0,0,.45)}.pie .value{position:absolute;right:0}.pie .title{margin-bottom:8px}.pie .total{position:absolute;top:50%;left:50%;max-height:62px;text-align:center;transform:translate(-50%,-50%)}.pie .total>h4{height:22px;margin-bottom:8px;color:rgba(0,0,0,.45);font-weight:400;font-size:14px;line-height:22px}.pie .total>p{display:block;height:32px;color:rgba(0,0,0,.85);font-size:1.2em;line-height:32px;white-space:nowrap}.legendBlock.hasLegend .chart{width:100%;margin:0 0 32px 0}.legendBlock .legend{position:relative;transform:none}.tagCloud{overflow:hidden}.tagCloud canvas{transform-origin:0 0}.waterWave{position:relative;display:inline-block;transform-origin:left}.waterWave .text{position:absolute;top:32px;left:0;width:100%;text-align:center}.waterWave .text span{color:rgba(0,0,0,.45);font-size:14px;line-height:22px}.waterWave .text h4{color:rgba(0,0,0,.85);font-size:24px;line-height:32px}.waterWave .waterWaveCanvasWrapper{transform:scale(.5);transform-origin:0 0}.timelineChart{background:#fff}.standardFormRow{display:flex;width:100%;margin-bottom:16px;padding-bottom:16px;border-bottom:1px dashed #f0f0f0}.standardFormRow .ant-form-item,.standardFormRow .ant-legacy-form-item{margin-right:24px}.standardFormRow .ant-form-item-label label,.standardFormRow .ant-legacy-form-item-label label{margin-right:0;color:rgba(0,0,0,.85)}.standardFormRow .ant-form-item-control,.standardFormRow .ant-form-item-label,.standardFormRow .ant-legacy-form-item-control,.standardFormRow .ant-legacy-form-item-label{padding:0;line-height:32px}.standardFormRow .label{flex:0 0 auto;margin-right:24px;color:rgba(0,0,0,.85);font-size:14px;text-align:right}.standardFormRow .label>span{display:inline-block;height:32px;line-height:32px}.standardFormRow .label>span::after{content:':'}.standardFormRow .content{flex:1 1 0}.standardFormRow .content :global .ant-form-item:last-child,.standardFormRow .content :global .ant-legacy-form-item:last-child{display:block;margin-right:0}.standardFormRowLast{margin-bottom:0;padding-bottom:0;border:none}.standardFormRowBlock :global .ant-form-item,.standardFormRowBlock :global .ant-legacy-form-item,.standardFormRowBlock :global div.ant-form-item-control-wrapper,.standardFormRowBlock :global div.ant-legacy-form-item-control-wrapper{display:block}.standardFormRowGrid .ant-form-item,.standardFormRowGrid .ant-legacy-form-item,.standardFormRowGrid div.ant-form-item-control-wrapper,.standardFormRowGrid div.ant-legacy-form-item-control-wrapper{display:block}.standardFormRowGrid .ant-form-item-label,.standardFormRowGrid .ant-legacy-form-item-label{float:left}.tagSelect{position:relative;max-height:32px;margin-left:-8px;overflow:hidden;line-height:32px;transition:all .3s;user-select:none}.tagSelect .ant-tag{margin-right:24px;padding:0 8px;font-size:14px}.tagSelect.expanded{max-height:200px;transition:all .3s}.tagSelect .trigger{position:absolute;top:0;right:0}.tagSelect .trigger span.anticon{font-size:12px}.tagSelect.hasExpandTag{padding-right:50px} \ No newline at end of file diff --git a/IoTSharp.Data.Oracle/IoTSharp.Data.Oracle.csproj b/IoTSharp.Data.Oracle/IoTSharp.Data.Oracle.csproj new file mode 100644 index 0000000000000000000000000000000000000000..5418a8f69ac586512981b2b74f5437029948b7ee --- /dev/null +++ b/IoTSharp.Data.Oracle/IoTSharp.Data.Oracle.csproj @@ -0,0 +1,22 @@ + + + + net5.0 + + + + + + + + + + + + + + + + + + diff --git a/IoTSharp.Data.Oracle/IoTSharpDataBuilderExtensions.cs b/IoTSharp.Data.Oracle/IoTSharpDataBuilderExtensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..6c7a2fd87c81ddce3084546fa642eaac703e4ffe --- /dev/null +++ b/IoTSharp.Data.Oracle/IoTSharpDataBuilderExtensions.cs @@ -0,0 +1,36 @@ + +using EFCore.Sharding; +using IoTSharp.Data; +using IoTSharp.Data.Oracle; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using System; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class IoTSharpDataBuilderExtensions + { + + + public static void ConfigureOracle(this IServiceCollection services, string connectionString, int poolSize, IHealthChecksBuilder checksBuilder, HealthChecksUIBuilder healthChecksUI) + { + services.AddEntityFrameworkOracle(); + services.AddSingleton( c=> new OracleModelBuilderOptions()); + services.AddDbContextPool(builder => + { + builder.UseOracle(connectionString, s => s.MigrationsAssembly("IoTSharp.Data.Oracle")); + builder.UseInternalServiceProvider(services.BuildServiceProvider()); + } + , poolSize); + checksBuilder.AddOracle(connectionString); + healthChecksUI.AddInMemoryStorage(); + + } + + public static void UseOracleToSharding(this IShardingBuilder builder, string connectionString, ExpandByDateMode expandBy) + { + builder.AddDataSource(connectionString, ReadWriteType.Read | ReadWriteType.Write, DatabaseType.Oracle); + builder.SetDateSharding(nameof(TelemetryData.DateTime), expandBy, DateTime.Now); + } + } +} diff --git a/IoTSharp.Data.Oracle/Migrations/20210215153716_OracleFirstSchema.Designer.cs b/IoTSharp.Data.Oracle/Migrations/20210215153716_OracleFirstSchema.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..47a7cc0c2e635a937e32164f6235ee42d5c615c3 --- /dev/null +++ b/IoTSharp.Data.Oracle/Migrations/20210215153716_OracleFirstSchema.Designer.cs @@ -0,0 +1,773 @@ +// +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("20210215153716_OracleFirstSchema")] + partial class OracleFirstSchema + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("ActionData") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ActionName") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ActionResult") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ActiveDateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("ObjectID") + .HasColumnType("RAW(16)"); + + b.Property("ObjectName") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ObjectType") + .HasColumnType("NUMBER(10)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.Property("UserId") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("UserName") + .HasColumnType("NVARCHAR2(2000)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("AuthToken") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("Address") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("City") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Country") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Email") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Phone") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Province") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Street") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.Property("ZipCode") + .HasColumnType("NUMBER(10)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("NUMBER(10)"); + + b.Property("DeviceId") + .HasColumnType("RAW(16)"); + + b.Property("KeyName") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("DataSide") + .HasColumnType("NUMBER(10)"); + + b.Property("DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Type") + .HasColumnType("NUMBER(10)"); + + b.Property("Value_Binary") + .HasColumnType("RAW(2000)"); + + b.Property("Value_Boolean") + .HasColumnType("NUMBER(1)"); + + b.Property("Value_DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Value_Double") + .HasColumnType("BINARY_DOUBLE"); + + b.Property("Value_Json") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Value_Long") + .HasColumnType("NUMBER(19)"); + + b.Property("Value_String") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Value_XML") + .HasColumnType("NVARCHAR2(2000)"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("AuthorizedKeyId") + .HasColumnType("RAW(16)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("DeviceType") + .HasColumnType("NUMBER(10)"); + + b.Property("LastActive") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Online") + .HasColumnType("NUMBER(1)"); + + b.Property("OwnerId") + .HasColumnType("RAW(16)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.Property("Timeout") + .HasColumnType("NUMBER(10)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("DeviceId") + .HasColumnType("RAW(16)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("IdentityType") + .HasColumnType("NUMBER(10)"); + + b.Property("IdentityValue") + .HasColumnType("NVARCHAR2(2000)"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("IdentityUserId") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("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("DeviceId") + .HasColumnType("RAW(16)"); + + b.Property("KeyName") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("DataSide") + .HasColumnType("NUMBER(10)"); + + b.Property("Type") + .HasColumnType("NUMBER(10)"); + + b.Property("Value_Binary") + .HasColumnType("RAW(2000)"); + + b.Property("Value_Boolean") + .HasColumnType("NUMBER(1)"); + + b.Property("Value_DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Value_Double") + .HasColumnType("BINARY_DOUBLE"); + + b.Property("Value_Json") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Value_Long") + .HasColumnType("NUMBER(19)"); + + b.Property("Value_String") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("Address") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("City") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Country") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("EMail") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Phone") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Province") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Street") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ZipCode") + .HasColumnType("NUMBER(10)"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("NUMBER(10)") + .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn); + + b.Property("ClaimType") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ClaimValue") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("NUMBER(10)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("NUMBER(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("NUMBER(1)"); + + b.Property("LockoutEnd") + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("PasswordHash") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("PhoneNumber") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("NUMBER(1)"); + + b.Property("SecurityStamp") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("NUMBER(1)"); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("NUMBER(10)") + .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn); + + b.Property("ClaimType") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ClaimValue") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("ProviderKey") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("RoleId") + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("LoginProvider") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("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", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", 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", 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 + } + } +} diff --git a/IoTSharp.Data.Oracle/Migrations/20210215153716_OracleFirstSchema.cs b/IoTSharp.Data.Oracle/Migrations/20210215153716_OracleFirstSchema.cs new file mode 100644 index 0000000000000000000000000000000000000000..62857ddbd28f05c42a1481126daf4208e66adc46 --- /dev/null +++ b/IoTSharp.Data.Oracle/Migrations/20210215153716_OracleFirstSchema.cs @@ -0,0 +1,588 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace IoTSharp.Data.Oracle.Migrations +{ + public partial class OracleFirstSchema : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "NVARCHAR2(450)", nullable: false), + Name = table.Column(type: "NVARCHAR2(256)", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "NVARCHAR2(256)", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "NVARCHAR2(2000)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "NVARCHAR2(450)", nullable: false), + UserName = table.Column(type: "NVARCHAR2(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "NVARCHAR2(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "NVARCHAR2(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "NVARCHAR2(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "NUMBER(1)", nullable: false), + PasswordHash = table.Column(type: "NVARCHAR2(2000)", nullable: true), + SecurityStamp = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ConcurrencyStamp = table.Column(type: "NVARCHAR2(2000)", nullable: true), + PhoneNumber = table.Column(type: "NVARCHAR2(2000)", nullable: true), + PhoneNumberConfirmed = table.Column(type: "NUMBER(1)", nullable: false), + TwoFactorEnabled = table.Column(type: "NUMBER(1)", nullable: false), + LockoutEnd = table.Column(type: "TIMESTAMP(7) WITH TIME ZONE", nullable: true), + LockoutEnabled = table.Column(type: "NUMBER(1)", nullable: false), + AccessFailedCount = table.Column(type: "NUMBER(10)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "DataStorage", + columns: table => new + { + Catalog = table.Column(type: "NUMBER(10)", nullable: false), + DeviceId = table.Column(type: "RAW(16)", nullable: false), + KeyName = table.Column(type: "NVARCHAR2(450)", nullable: false), + DateTime = table.Column(type: "TIMESTAMP(7)", nullable: false), + DataSide = table.Column(type: "NUMBER(10)", nullable: false), + Type = table.Column(type: "NUMBER(10)", nullable: false), + Value_Boolean = table.Column(type: "NUMBER(1)", nullable: false), + Value_String = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Value_Long = table.Column(type: "NUMBER(19)", nullable: false), + Value_DateTime = table.Column(type: "TIMESTAMP(7)", nullable: false), + Value_Double = table.Column(type: "BINARY_DOUBLE", nullable: false), + Value_Json = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Value_XML = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Value_Binary = table.Column(type: "RAW(2000)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DataStorage", x => new { x.Catalog, x.DeviceId, x.KeyName }); + }); + + migrationBuilder.CreateTable( + name: "TelemetryData", + columns: table => new + { + DateTime = table.Column(type: "TIMESTAMP(7)", nullable: false), + DeviceId = table.Column(type: "RAW(16)", nullable: false), + KeyName = table.Column(type: "NVARCHAR2(450)", nullable: false), + DataSide = table.Column(type: "NUMBER(10)", nullable: false), + Type = table.Column(type: "NUMBER(10)", nullable: false), + Value_Boolean = table.Column(type: "NUMBER(1)", nullable: false), + Value_String = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Value_Long = table.Column(type: "NUMBER(19)", nullable: false), + Value_DateTime = table.Column(type: "TIMESTAMP(7)", nullable: false), + Value_Double = table.Column(type: "BINARY_DOUBLE", nullable: false), + Value_Json = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Value_XML = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Value_Binary = table.Column(type: "RAW(2000)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TelemetryData", x => new { x.DeviceId, x.KeyName, x.DateTime }); + }); + + migrationBuilder.CreateTable( + name: "Tenant", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false), + Name = table.Column(type: "NVARCHAR2(2000)", nullable: true), + EMail = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Phone = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Country = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Province = table.Column(type: "NVARCHAR2(2000)", nullable: true), + City = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Street = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Address = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ZipCode = table.Column(type: "NUMBER(10)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tenant", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "NUMBER(10)", nullable: false) + .Annotation("Oracle:Identity", "1, 1"), + RoleId = table.Column(type: "NVARCHAR2(450)", nullable: false), + ClaimType = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ClaimValue = table.Column(type: "NVARCHAR2(2000)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "NUMBER(10)", nullable: false) + .Annotation("Oracle:Identity", "1, 1"), + UserId = table.Column(type: "NVARCHAR2(450)", nullable: false), + ClaimType = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ClaimValue = table.Column(type: "NVARCHAR2(2000)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "NVARCHAR2(450)", nullable: false), + ProviderKey = table.Column(type: "NVARCHAR2(450)", nullable: false), + ProviderDisplayName = table.Column(type: "NVARCHAR2(2000)", nullable: true), + UserId = table.Column(type: "NVARCHAR2(450)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "NVARCHAR2(450)", nullable: false), + RoleId = table.Column(type: "NVARCHAR2(450)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "NVARCHAR2(450)", nullable: false), + LoginProvider = table.Column(type: "NVARCHAR2(450)", nullable: false), + Name = table.Column(type: "NVARCHAR2(450)", nullable: false), + Value = table.Column(type: "NVARCHAR2(2000)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Customer", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false), + Name = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Email = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Phone = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Country = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Province = table.Column(type: "NVARCHAR2(2000)", nullable: true), + City = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Street = table.Column(type: "NVARCHAR2(2000)", nullable: true), + Address = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ZipCode = table.Column(type: "NUMBER(10)", nullable: false), + TenantId = table.Column(type: "RAW(16)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Customer", x => x.Id); + table.ForeignKey( + name: "FK_Customer_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AuditLog", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false), + TenantId = table.Column(type: "RAW(16)", nullable: true), + CustomerId = table.Column(type: "RAW(16)", nullable: true), + UserId = table.Column(type: "NVARCHAR2(2000)", nullable: true), + UserName = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ObjectID = table.Column(type: "RAW(16)", nullable: false), + ObjectName = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ObjectType = table.Column(type: "NUMBER(10)", nullable: false), + ActionName = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ActionData = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ActionResult = table.Column(type: "NVARCHAR2(2000)", nullable: true), + ActiveDateTime = table.Column(type: "TIMESTAMP(7)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AuditLog", x => x.Id); + table.ForeignKey( + name: "FK_AuditLog_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_AuditLog_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AuthorizedKeys", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false), + Name = table.Column(type: "NVARCHAR2(2000)", nullable: true), + AuthToken = table.Column(type: "NVARCHAR2(2000)", nullable: true), + TenantId = table.Column(type: "RAW(16)", nullable: true), + CustomerId = table.Column(type: "RAW(16)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AuthorizedKeys", x => x.Id); + table.ForeignKey( + name: "FK_AuthorizedKeys_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_AuthorizedKeys_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Relationship", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false), + IdentityUserId = table.Column(type: "NVARCHAR2(450)", nullable: true), + TenantId = table.Column(type: "RAW(16)", nullable: true), + CustomerId = table.Column(type: "RAW(16)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Relationship", x => x.Id); + table.ForeignKey( + name: "FK_Relationship_AspNetUsers_IdentityUserId", + column: x => x.IdentityUserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Relationship_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Relationship_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Device", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false), + Name = table.Column(type: "NVARCHAR2(2000)", nullable: true), + DeviceType = table.Column(type: "NUMBER(10)", nullable: false), + Online = table.Column(type: "NUMBER(1)", nullable: false), + LastActive = table.Column(type: "TIMESTAMP(7)", nullable: false), + Timeout = table.Column(type: "NUMBER(10)", nullable: false), + OwnerId = table.Column(type: "RAW(16)", nullable: true), + TenantId = table.Column(type: "RAW(16)", nullable: true), + CustomerId = table.Column(type: "RAW(16)", nullable: true), + AuthorizedKeyId = table.Column(type: "RAW(16)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Device", x => x.Id); + table.ForeignKey( + name: "FK_Device_AuthorizedKeys_AuthorizedKeyId", + column: x => x.AuthorizedKeyId, + principalTable: "AuthorizedKeys", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Device_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Device_Device_OwnerId", + column: x => x.OwnerId, + principalTable: "Device", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Device_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "DeviceIdentities", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false), + IdentityType = table.Column(type: "NUMBER(10)", nullable: false), + IdentityId = table.Column(type: "NVARCHAR2(2000)", nullable: false), + IdentityValue = table.Column(type: "NVARCHAR2(2000)", nullable: true), + DeviceId = table.Column(type: "RAW(16)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DeviceIdentities", x => x.Id); + table.ForeignKey( + name: "FK_DeviceIdentities_Device_DeviceId", + column: x => x.DeviceId, + principalTable: "Device", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true, + filter: "\"NormalizedName\" IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true, + filter: "\"NormalizedUserName\" IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_AuditLog_CustomerId", + table: "AuditLog", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_AuditLog_TenantId", + table: "AuditLog", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AuthorizedKeys_CustomerId", + table: "AuthorizedKeys", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_AuthorizedKeys_TenantId", + table: "AuthorizedKeys", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Customer_TenantId", + table: "Customer", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DataStorage_Catalog", + table: "DataStorage", + column: "Catalog"); + + migrationBuilder.CreateIndex( + name: "IX_DataStorage_Catalog_DeviceId", + table: "DataStorage", + columns: new[] { "Catalog", "DeviceId" }); + + migrationBuilder.CreateIndex( + name: "IX_Device_AuthorizedKeyId", + table: "Device", + column: "AuthorizedKeyId"); + + migrationBuilder.CreateIndex( + name: "IX_Device_CustomerId", + table: "Device", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Device_OwnerId", + table: "Device", + column: "OwnerId"); + + migrationBuilder.CreateIndex( + name: "IX_Device_TenantId", + table: "Device", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DeviceIdentities_DeviceId", + table: "DeviceIdentities", + column: "DeviceId"); + + migrationBuilder.CreateIndex( + name: "IX_Relationship_CustomerId", + table: "Relationship", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Relationship_IdentityUserId", + table: "Relationship", + column: "IdentityUserId"); + + migrationBuilder.CreateIndex( + name: "IX_Relationship_TenantId", + table: "Relationship", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_TelemetryData_DeviceId", + table: "TelemetryData", + column: "DeviceId"); + + migrationBuilder.CreateIndex( + name: "IX_TelemetryData_DeviceId_KeyName", + table: "TelemetryData", + columns: new[] { "DeviceId", "KeyName" }); + + migrationBuilder.CreateIndex( + name: "IX_TelemetryData_KeyName", + table: "TelemetryData", + column: "KeyName"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens"); + + migrationBuilder.DropTable( + name: "AuditLog"); + + migrationBuilder.DropTable( + name: "DataStorage"); + + migrationBuilder.DropTable( + name: "DeviceIdentities"); + + migrationBuilder.DropTable( + name: "Relationship"); + + migrationBuilder.DropTable( + name: "TelemetryData"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "Device"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "AuthorizedKeys"); + + migrationBuilder.DropTable( + name: "Customer"); + + migrationBuilder.DropTable( + name: "Tenant"); + } + } +} diff --git a/IoTSharp.Data.Oracle/Migrations/ApplicationDbContextModelSnapshot.cs b/IoTSharp.Data.Oracle/Migrations/ApplicationDbContextModelSnapshot.cs new file mode 100644 index 0000000000000000000000000000000000000000..33f23471d2194fec8a0bbce5da6a2c4697fea8c5 --- /dev/null +++ b/IoTSharp.Data.Oracle/Migrations/ApplicationDbContextModelSnapshot.cs @@ -0,0 +1,771 @@ +// +using System; +using IoTSharp.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Oracle.EntityFrameworkCore.Metadata; + +namespace IoTSharp.Data.Oracle.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + partial class ApplicationDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.3") + .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("ActionData") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ActionName") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ActionResult") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ActiveDateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("ObjectID") + .HasColumnType("RAW(16)"); + + b.Property("ObjectName") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ObjectType") + .HasColumnType("NUMBER(10)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.Property("UserId") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("UserName") + .HasColumnType("NVARCHAR2(2000)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("AuthToken") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("Address") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("City") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Country") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Email") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Phone") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Province") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Street") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.Property("ZipCode") + .HasColumnType("NUMBER(10)"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("NUMBER(10)"); + + b.Property("DeviceId") + .HasColumnType("RAW(16)"); + + b.Property("KeyName") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("DataSide") + .HasColumnType("NUMBER(10)"); + + b.Property("DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Type") + .HasColumnType("NUMBER(10)"); + + b.Property("Value_Binary") + .HasColumnType("RAW(2000)"); + + b.Property("Value_Boolean") + .HasColumnType("NUMBER(1)"); + + b.Property("Value_DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Value_Double") + .HasColumnType("BINARY_DOUBLE"); + + b.Property("Value_Json") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Value_Long") + .HasColumnType("NUMBER(19)"); + + b.Property("Value_String") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Value_XML") + .HasColumnType("NVARCHAR2(2000)"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("AuthorizedKeyId") + .HasColumnType("RAW(16)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("DeviceType") + .HasColumnType("NUMBER(10)"); + + b.Property("LastActive") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Online") + .HasColumnType("NUMBER(1)"); + + b.Property("OwnerId") + .HasColumnType("RAW(16)"); + + b.Property("TenantId") + .HasColumnType("RAW(16)"); + + b.Property("Timeout") + .HasColumnType("NUMBER(10)"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("DeviceId") + .HasColumnType("RAW(16)"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("IdentityType") + .HasColumnType("NUMBER(10)"); + + b.Property("IdentityValue") + .HasColumnType("NVARCHAR2(2000)"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("CustomerId") + .HasColumnType("RAW(16)"); + + b.Property("IdentityUserId") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("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("DeviceId") + .HasColumnType("RAW(16)"); + + b.Property("KeyName") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("DataSide") + .HasColumnType("NUMBER(10)"); + + b.Property("Type") + .HasColumnType("NUMBER(10)"); + + b.Property("Value_Binary") + .HasColumnType("RAW(2000)"); + + b.Property("Value_Boolean") + .HasColumnType("NUMBER(1)"); + + b.Property("Value_DateTime") + .HasColumnType("TIMESTAMP(7)"); + + b.Property("Value_Double") + .HasColumnType("BINARY_DOUBLE"); + + b.Property("Value_Json") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Value_Long") + .HasColumnType("NUMBER(19)"); + + b.Property("Value_String") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)"); + + b.Property("Address") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("City") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Country") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("EMail") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Phone") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Province") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Street") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ZipCode") + .HasColumnType("NUMBER(10)"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("NUMBER(10)") + .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn); + + b.Property("ClaimType") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ClaimValue") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("AccessFailedCount") + .HasColumnType("NUMBER(10)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("NUMBER(1)"); + + b.Property("LockoutEnabled") + .HasColumnType("NUMBER(1)"); + + b.Property("LockoutEnd") + .HasColumnType("TIMESTAMP(7) WITH TIME ZONE"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("NVARCHAR2(256)"); + + b.Property("PasswordHash") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("PhoneNumber") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("NUMBER(1)"); + + b.Property("SecurityStamp") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("NUMBER(1)"); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("NUMBER(10)") + .HasAnnotation("Oracle:ValueGenerationStrategy", OracleValueGenerationStrategy.IdentityColumn); + + b.Property("ClaimType") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("ClaimValue") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("ProviderKey") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("NVARCHAR2(2000)"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("RoleId") + .HasColumnType("NVARCHAR2(450)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("LoginProvider") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("Name") + .HasColumnType("NVARCHAR2(450)"); + + b.Property("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", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", 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", 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 + } + } +} diff --git a/IoTSharp.Data.Oracle/OracleModelBuilderOptions.cs b/IoTSharp.Data.Oracle/OracleModelBuilderOptions.cs new file mode 100644 index 0000000000000000000000000000000000000000..c969aa39c9c54aafc48c98105fa480e0fda4a525 --- /dev/null +++ b/IoTSharp.Data.Oracle/OracleModelBuilderOptions.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using System; + +namespace IoTSharp.Data.Oracle +{ + public class OracleModelBuilderOptions : IDataBaseModelBuilderOptions + { + public OracleModelBuilderOptions() + { + } + + public IInfrastructure Infrastructure { get; set; } + + public void OnModelCreating(ModelBuilder modelBuilder) + { + + } + } +} \ No newline at end of file diff --git a/IoTSharp.Data.SqlServer/MsSqlModelBuilderOptions.cs b/IoTSharp.Data.SqlServer/MsSqlModelBuilderOptions.cs index 40ec57448226bdac65540633532778ed9fc2949d..1c90d9a68ebcc77d64afde7c6e7fb23c903c857d 100644 --- a/IoTSharp.Data.SqlServer/MsSqlModelBuilderOptions.cs +++ b/IoTSharp.Data.SqlServer/MsSqlModelBuilderOptions.cs @@ -14,59 +14,7 @@ namespace IoTSharp.Data.SqlServer public void OnModelCreating(ModelBuilder modelBuilder) { - //modelBuilder.Entity() - //.Property(b => b.DateTime) - //.HasColumnType("timestamp with time zone"); - //modelBuilder.Entity() - //.Property(b => b.Value_DateTime) - //.HasColumnType("timestamp with time zone"); - - //modelBuilder.Entity() - //.Property(b => b.DateTime) - //.HasColumnType("timestamp with time zone"); - - //modelBuilder.Entity() - //.Property(b => b.Value_DateTime) - //.HasColumnType("timestamp with time zone"); - - //modelBuilder.Entity() - //.Property(b => b.DateTime) - //.HasColumnType("timestamp with time zone"); - //modelBuilder.Entity() - //.Property(b => b.Value_DateTime) - //.HasColumnType("timestamp with time zone"); - - //modelBuilder.Entity() - //.Property(b => b.Value_Json) - //.HasColumnType("jsonb"); - - //modelBuilder.Entity() - //.Property(b => b.Value_XML) - //.HasColumnType("xml"); - - //modelBuilder.Entity() - //.Property(b => b.Value_Json) - //.HasColumnType("jsonb"); - - //modelBuilder.Entity() - //.Property(b => b.Value_XML) - //.HasColumnType("xml"); - - //modelBuilder.Entity() - //.Property(b => b.Value_Json) - //.HasColumnType("jsonb"); - - //modelBuilder.Entity() - //.Property(b => b.Value_XML) - //.HasColumnType("xml"); - - //modelBuilder.Entity() - //.Property(b => b.ActionData) - //.HasColumnType("jsonb"); - - //modelBuilder.Entity() - //.Property(b => b.ActionResult) - //.HasColumnType("jsonb"); + } } } \ No newline at end of file diff --git a/IoTSharp.Data.Sqlite/IoTSharp.Data.Sqlite.csproj b/IoTSharp.Data.Sqlite/IoTSharp.Data.Sqlite.csproj new file mode 100644 index 0000000000000000000000000000000000000000..c394b2754301bfec0860d054f0c5f944ef88410c --- /dev/null +++ b/IoTSharp.Data.Sqlite/IoTSharp.Data.Sqlite.csproj @@ -0,0 +1,23 @@ + + + + net5.0 + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/IoTSharp.Data.Sqlite/IoTSharpDataBuilderExtensions.cs b/IoTSharp.Data.Sqlite/IoTSharpDataBuilderExtensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..8ec0b4948fb15cec80a251f3af03875624fb74ee --- /dev/null +++ b/IoTSharp.Data.Sqlite/IoTSharpDataBuilderExtensions.cs @@ -0,0 +1,36 @@ + +using EFCore.Sharding; +using IoTSharp.Data; +using IoTSharp.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using System; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class IoTSharpDataBuilderExtensions + { + + + public static void ConfigureSqlite(this IServiceCollection services, string connectionString, int poolSize, IHealthChecksBuilder checksBuilder, HealthChecksUIBuilder healthChecksUI) + { + services.AddEntityFrameworkSqlite(); + services.AddSingleton( c=> new SqliteModelBuilderOptions()); + services.AddDbContextPool(builder => + { + builder.UseSqlite(connectionString, s => s.MigrationsAssembly("IoTSharp.Data.Sqlite")); + builder.UseInternalServiceProvider(services.BuildServiceProvider()); + } + , poolSize); + checksBuilder.AddSqlite(connectionString); + healthChecksUI.AddSqliteStorage("Data Source=health_checks.db"); + + } + + public static void UseSQLiteToSharding(this IShardingBuilder builder, string connectionString, ExpandByDateMode expandBy) + { + builder.AddDataSource(connectionString, ReadWriteType.Read | ReadWriteType.Write, DatabaseType.SQLite); + builder.SetDateSharding(nameof(TelemetryData.DateTime), expandBy, DateTime.Now); + } + } +} diff --git a/IoTSharp.Data.Sqlite/Migrations/20210215135656_SqliteFirstSchema.Designer.cs b/IoTSharp.Data.Sqlite/Migrations/20210215135656_SqliteFirstSchema.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..4b446c01423ad45d3c53213b14301fee059774f3 --- /dev/null +++ b/IoTSharp.Data.Sqlite/Migrations/20210215135656_SqliteFirstSchema.Designer.cs @@ -0,0 +1,768 @@ +// +using System; +using IoTSharp.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace IoTSharp.Data.Sqlite.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20210215135656_SqliteFirstSchema")] + partial class SqliteFirstSchema + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.3"); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ActionData") + .HasColumnType("TEXT"); + + b.Property("ActionName") + .HasColumnType("TEXT"); + + b.Property("ActionResult") + .HasColumnType("TEXT"); + + b.Property("ActiveDateTime") + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("ObjectID") + .HasColumnType("TEXT"); + + b.Property("ObjectName") + .HasColumnType("TEXT"); + + b.Property("ObjectType") + .HasColumnType("INTEGER"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("UserName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AuthToken") + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Address") + .HasColumnType("TEXT"); + + b.Property("City") + .HasColumnType("TEXT"); + + b.Property("Country") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Phone") + .HasColumnType("TEXT"); + + b.Property("Province") + .HasColumnType("TEXT"); + + b.Property("Street") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("INTEGER"); + + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("KeyName") + .HasColumnType("TEXT"); + + b.Property("DataSide") + .HasColumnType("INTEGER"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("Value_Binary") + .HasColumnType("BLOB"); + + b.Property("Value_Boolean") + .HasColumnType("INTEGER"); + + b.Property("Value_DateTime") + .HasColumnType("TEXT"); + + b.Property("Value_Double") + .HasColumnType("REAL"); + + b.Property("Value_Json") + .HasColumnType("TEXT"); + + b.Property("Value_Long") + .HasColumnType("INTEGER"); + + b.Property("Value_String") + .HasColumnType("TEXT"); + + b.Property("Value_XML") + .HasColumnType("TEXT"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AuthorizedKeyId") + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("DeviceType") + .HasColumnType("INTEGER"); + + b.Property("LastActive") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Online") + .HasColumnType("INTEGER"); + + b.Property("OwnerId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Timeout") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IdentityType") + .HasColumnType("INTEGER"); + + b.Property("IdentityValue") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("IdentityUserId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Relationship"); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryData", b => + { + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("KeyName") + .HasColumnType("TEXT"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("DataSide") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("Value_Binary") + .HasColumnType("BLOB"); + + b.Property("Value_Boolean") + .HasColumnType("INTEGER"); + + b.Property("Value_DateTime") + .HasColumnType("TEXT"); + + b.Property("Value_Double") + .HasColumnType("REAL"); + + b.Property("Value_Json") + .HasColumnType("TEXT"); + + b.Property("Value_Long") + .HasColumnType("INTEGER"); + + b.Property("Value_String") + .HasColumnType("TEXT"); + + b.Property("Value_XML") + .HasColumnType("TEXT"); + + b.HasKey("DeviceId", "KeyName", "DateTime"); + + b.HasIndex("DeviceId"); + + b.HasIndex("KeyName"); + + b.HasIndex("DeviceId", "KeyName"); + + b.HasIndex("DeviceId", "KeyName", "DateTime"); + + b.ToTable("TelemetryData"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Address") + .HasColumnType("TEXT"); + + b.Property("City") + .HasColumnType("TEXT"); + + b.Property("Country") + .HasColumnType("TEXT"); + + b.Property("EMail") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Phone") + .HasColumnType("TEXT"); + + b.Property("Province") + .HasColumnType("TEXT"); + + b.Property("Street") + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("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.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", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", 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", 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 + } + } +} diff --git a/IoTSharp.Data.Sqlite/Migrations/20210215135656_SqliteFirstSchema.cs b/IoTSharp.Data.Sqlite/Migrations/20210215135656_SqliteFirstSchema.cs new file mode 100644 index 0000000000000000000000000000000000000000..5c9a5cf7e355d05364e8abfcb26551d4ff67334e --- /dev/null +++ b/IoTSharp.Data.Sqlite/Migrations/20210215135656_SqliteFirstSchema.cs @@ -0,0 +1,591 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace IoTSharp.Data.Sqlite.Migrations +{ + public partial class SqliteFirstSchema : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AspNetRoles", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetUsers", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "TEXT", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", nullable: true), + SecurityStamp = table.Column(type: "TEXT", nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), + PhoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "DataStorage", + columns: table => new + { + Catalog = table.Column(type: "INTEGER", nullable: false), + DeviceId = table.Column(type: "TEXT", nullable: false), + KeyName = table.Column(type: "TEXT", nullable: false), + DateTime = table.Column(type: "TEXT", nullable: false), + DataSide = table.Column(type: "INTEGER", nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + Value_Boolean = table.Column(type: "INTEGER", nullable: false), + Value_String = table.Column(type: "TEXT", nullable: true), + Value_Long = table.Column(type: "INTEGER", nullable: false), + Value_DateTime = table.Column(type: "TEXT", nullable: false), + Value_Double = table.Column(type: "REAL", nullable: false), + Value_Json = table.Column(type: "TEXT", nullable: true), + Value_XML = table.Column(type: "TEXT", nullable: true), + Value_Binary = table.Column(type: "BLOB", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DataStorage", x => new { x.Catalog, x.DeviceId, x.KeyName }); + }); + + migrationBuilder.CreateTable( + name: "TelemetryData", + columns: table => new + { + DateTime = table.Column(type: "TEXT", nullable: false), + DeviceId = table.Column(type: "TEXT", nullable: false), + KeyName = table.Column(type: "TEXT", nullable: false), + DataSide = table.Column(type: "INTEGER", nullable: false), + Type = table.Column(type: "INTEGER", nullable: false), + Value_Boolean = table.Column(type: "INTEGER", nullable: false), + Value_String = table.Column(type: "TEXT", nullable: true), + Value_Long = table.Column(type: "INTEGER", nullable: false), + Value_DateTime = table.Column(type: "TEXT", nullable: false), + Value_Double = table.Column(type: "REAL", nullable: false), + Value_Json = table.Column(type: "TEXT", nullable: true), + Value_XML = table.Column(type: "TEXT", nullable: true), + Value_Binary = table.Column(type: "BLOB", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TelemetryData", x => new { x.DeviceId, x.KeyName, x.DateTime }); + }); + + migrationBuilder.CreateTable( + name: "Tenant", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + EMail = table.Column(type: "TEXT", nullable: true), + Phone = table.Column(type: "TEXT", nullable: true), + Country = table.Column(type: "TEXT", nullable: true), + Province = table.Column(type: "TEXT", nullable: true), + City = table.Column(type: "TEXT", nullable: true), + Street = table.Column(type: "TEXT", nullable: true), + Address = table.Column(type: "TEXT", nullable: true), + ZipCode = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Tenant", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AspNetRoleClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserClaims", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AspNetUserClaims_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserLogins", + columns: table => new + { + LoginProvider = table.Column(type: "TEXT", nullable: false), + ProviderKey = table.Column(type: "TEXT", nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_AspNetUserLogins_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserRoles", + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + RoleId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetRoles_RoleId", + column: x => x.RoleId, + principalTable: "AspNetRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AspNetUserRoles_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AspNetUserTokens", + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + LoginProvider = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AspNetUserTokens_AspNetUsers_UserId", + column: x => x.UserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Customer", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + Email = table.Column(type: "TEXT", nullable: true), + Phone = table.Column(type: "TEXT", nullable: true), + Country = table.Column(type: "TEXT", nullable: true), + Province = table.Column(type: "TEXT", nullable: true), + City = table.Column(type: "TEXT", nullable: true), + Street = table.Column(type: "TEXT", nullable: true), + Address = table.Column(type: "TEXT", nullable: true), + ZipCode = table.Column(type: "INTEGER", nullable: false), + TenantId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Customer", x => x.Id); + table.ForeignKey( + name: "FK_Customer_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AuditLog", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + TenantId = table.Column(type: "TEXT", nullable: true), + CustomerId = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "TEXT", nullable: true), + UserName = table.Column(type: "TEXT", nullable: true), + ObjectID = table.Column(type: "TEXT", nullable: false), + ObjectName = table.Column(type: "TEXT", nullable: true), + ObjectType = table.Column(type: "INTEGER", nullable: false), + ActionName = table.Column(type: "TEXT", nullable: true), + ActionData = table.Column(type: "TEXT", nullable: true), + ActionResult = table.Column(type: "TEXT", nullable: true), + ActiveDateTime = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AuditLog", x => x.Id); + table.ForeignKey( + name: "FK_AuditLog_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_AuditLog_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "AuthorizedKeys", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + AuthToken = table.Column(type: "TEXT", nullable: true), + TenantId = table.Column(type: "TEXT", nullable: true), + CustomerId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AuthorizedKeys", x => x.Id); + table.ForeignKey( + name: "FK_AuthorizedKeys_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_AuthorizedKeys_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Relationship", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + IdentityUserId = table.Column(type: "TEXT", nullable: true), + TenantId = table.Column(type: "TEXT", nullable: true), + CustomerId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Relationship", x => x.Id); + table.ForeignKey( + name: "FK_Relationship_AspNetUsers_IdentityUserId", + column: x => x.IdentityUserId, + principalTable: "AspNetUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Relationship_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Relationship_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Device", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: true), + DeviceType = table.Column(type: "INTEGER", nullable: false), + Online = table.Column(type: "INTEGER", nullable: false), + LastActive = table.Column(type: "TEXT", nullable: false), + Timeout = table.Column(type: "INTEGER", nullable: false), + OwnerId = table.Column(type: "TEXT", nullable: true), + TenantId = table.Column(type: "TEXT", nullable: true), + CustomerId = table.Column(type: "TEXT", nullable: true), + AuthorizedKeyId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Device", x => x.Id); + table.ForeignKey( + name: "FK_Device_AuthorizedKeys_AuthorizedKeyId", + column: x => x.AuthorizedKeyId, + principalTable: "AuthorizedKeys", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Device_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Device_Device_OwnerId", + column: x => x.OwnerId, + principalTable: "Device", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Device_Tenant_TenantId", + column: x => x.TenantId, + principalTable: "Tenant", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "DeviceIdentities", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + IdentityType = table.Column(type: "INTEGER", nullable: false), + IdentityId = table.Column(type: "TEXT", nullable: false), + IdentityValue = table.Column(type: "TEXT", nullable: true), + DeviceId = table.Column(type: "TEXT", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DeviceIdentities", x => x.Id); + table.ForeignKey( + name: "FK_DeviceIdentities_Device_DeviceId", + column: x => x.DeviceId, + principalTable: "Device", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_AspNetRoleClaims_RoleId", + table: "AspNetRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "AspNetRoles", + column: "NormalizedName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserClaims_UserId", + table: "AspNetUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserLogins_UserId", + table: "AspNetUserLogins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AspNetUserRoles_RoleId", + table: "AspNetUserRoles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "AspNetUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "AspNetUsers", + column: "NormalizedUserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_AuditLog_CustomerId", + table: "AuditLog", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_AuditLog_TenantId", + table: "AuditLog", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_AuthorizedKeys_CustomerId", + table: "AuthorizedKeys", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_AuthorizedKeys_TenantId", + table: "AuthorizedKeys", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_Customer_TenantId", + table: "Customer", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DataStorage_Catalog", + table: "DataStorage", + column: "Catalog"); + + migrationBuilder.CreateIndex( + name: "IX_DataStorage_Catalog_DeviceId", + table: "DataStorage", + columns: new[] { "Catalog", "DeviceId" }); + + migrationBuilder.CreateIndex( + name: "IX_Device_AuthorizedKeyId", + table: "Device", + column: "AuthorizedKeyId"); + + migrationBuilder.CreateIndex( + name: "IX_Device_CustomerId", + table: "Device", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Device_OwnerId", + table: "Device", + column: "OwnerId"); + + migrationBuilder.CreateIndex( + name: "IX_Device_TenantId", + table: "Device", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_DeviceIdentities_DeviceId", + table: "DeviceIdentities", + column: "DeviceId"); + + migrationBuilder.CreateIndex( + name: "IX_Relationship_CustomerId", + table: "Relationship", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Relationship_IdentityUserId", + table: "Relationship", + column: "IdentityUserId"); + + migrationBuilder.CreateIndex( + name: "IX_Relationship_TenantId", + table: "Relationship", + column: "TenantId"); + + migrationBuilder.CreateIndex( + name: "IX_TelemetryData_DeviceId", + table: "TelemetryData", + column: "DeviceId"); + + migrationBuilder.CreateIndex( + name: "IX_TelemetryData_DeviceId_KeyName", + table: "TelemetryData", + columns: new[] { "DeviceId", "KeyName" }); + + migrationBuilder.CreateIndex( + name: "IX_TelemetryData_DeviceId_KeyName_DateTime", + table: "TelemetryData", + columns: new[] { "DeviceId", "KeyName", "DateTime" }); + + migrationBuilder.CreateIndex( + name: "IX_TelemetryData_KeyName", + table: "TelemetryData", + column: "KeyName"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AspNetRoleClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserClaims"); + + migrationBuilder.DropTable( + name: "AspNetUserLogins"); + + migrationBuilder.DropTable( + name: "AspNetUserRoles"); + + migrationBuilder.DropTable( + name: "AspNetUserTokens"); + + migrationBuilder.DropTable( + name: "AuditLog"); + + migrationBuilder.DropTable( + name: "DataStorage"); + + migrationBuilder.DropTable( + name: "DeviceIdentities"); + + migrationBuilder.DropTable( + name: "Relationship"); + + migrationBuilder.DropTable( + name: "TelemetryData"); + + migrationBuilder.DropTable( + name: "AspNetRoles"); + + migrationBuilder.DropTable( + name: "Device"); + + migrationBuilder.DropTable( + name: "AspNetUsers"); + + migrationBuilder.DropTable( + name: "AuthorizedKeys"); + + migrationBuilder.DropTable( + name: "Customer"); + + migrationBuilder.DropTable( + name: "Tenant"); + } + } +} diff --git a/IoTSharp.Data.Sqlite/Migrations/ApplicationDbContextModelSnapshot.cs b/IoTSharp.Data.Sqlite/Migrations/ApplicationDbContextModelSnapshot.cs new file mode 100644 index 0000000000000000000000000000000000000000..3e6a20257c15146bcc238a438efcc8857a8a76bf --- /dev/null +++ b/IoTSharp.Data.Sqlite/Migrations/ApplicationDbContextModelSnapshot.cs @@ -0,0 +1,766 @@ +// +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.3"); + + modelBuilder.Entity("IoTSharp.Data.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("ActionData") + .HasColumnType("TEXT"); + + b.Property("ActionName") + .HasColumnType("TEXT"); + + b.Property("ActionResult") + .HasColumnType("TEXT"); + + b.Property("ActiveDateTime") + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("ObjectID") + .HasColumnType("TEXT"); + + b.Property("ObjectName") + .HasColumnType("TEXT"); + + b.Property("ObjectType") + .HasColumnType("INTEGER"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("UserName") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuditLog"); + }); + + modelBuilder.Entity("IoTSharp.Data.AuthorizedKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AuthToken") + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("TenantId"); + + b.ToTable("AuthorizedKeys"); + }); + + modelBuilder.Entity("IoTSharp.Data.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Address") + .HasColumnType("TEXT"); + + b.Property("City") + .HasColumnType("TEXT"); + + b.Property("Country") + .HasColumnType("TEXT"); + + b.Property("Email") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Phone") + .HasColumnType("TEXT"); + + b.Property("Province") + .HasColumnType("TEXT"); + + b.Property("Street") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("Customer"); + }); + + modelBuilder.Entity("IoTSharp.Data.DataStorage", b => + { + b.Property("Catalog") + .HasColumnType("INTEGER"); + + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("KeyName") + .HasColumnType("TEXT"); + + b.Property("DataSide") + .HasColumnType("INTEGER"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("Value_Binary") + .HasColumnType("BLOB"); + + b.Property("Value_Boolean") + .HasColumnType("INTEGER"); + + b.Property("Value_DateTime") + .HasColumnType("TEXT"); + + b.Property("Value_Double") + .HasColumnType("REAL"); + + b.Property("Value_Json") + .HasColumnType("TEXT"); + + b.Property("Value_Long") + .HasColumnType("INTEGER"); + + b.Property("Value_String") + .HasColumnType("TEXT"); + + b.Property("Value_XML") + .HasColumnType("TEXT"); + + b.HasKey("Catalog", "DeviceId", "KeyName"); + + b.HasIndex("Catalog"); + + b.HasIndex("Catalog", "DeviceId"); + + b.ToTable("DataStorage"); + + b.HasDiscriminator("Catalog").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.Device", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("AuthorizedKeyId") + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("DeviceType") + .HasColumnType("INTEGER"); + + b.Property("LastActive") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Online") + .HasColumnType("INTEGER"); + + b.Property("OwnerId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.Property("Timeout") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("AuthorizedKeyId"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("TenantId"); + + b.ToTable("Device"); + + b.HasDiscriminator("DeviceType").HasValue(0); + }); + + modelBuilder.Entity("IoTSharp.Data.DeviceIdentity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("IdentityId") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IdentityType") + .HasColumnType("INTEGER"); + + b.Property("IdentityValue") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("DeviceId"); + + b.ToTable("DeviceIdentities"); + }); + + modelBuilder.Entity("IoTSharp.Data.Relationship", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("CustomerId") + .HasColumnType("TEXT"); + + b.Property("IdentityUserId") + .HasColumnType("TEXT"); + + b.Property("TenantId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("IdentityUserId"); + + b.HasIndex("TenantId"); + + b.ToTable("Relationship"); + }); + + modelBuilder.Entity("IoTSharp.Data.TelemetryData", b => + { + b.Property("DeviceId") + .HasColumnType("TEXT"); + + b.Property("KeyName") + .HasColumnType("TEXT"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("DataSide") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.Property("Value_Binary") + .HasColumnType("BLOB"); + + b.Property("Value_Boolean") + .HasColumnType("INTEGER"); + + b.Property("Value_DateTime") + .HasColumnType("TEXT"); + + b.Property("Value_Double") + .HasColumnType("REAL"); + + b.Property("Value_Json") + .HasColumnType("TEXT"); + + b.Property("Value_Long") + .HasColumnType("INTEGER"); + + b.Property("Value_String") + .HasColumnType("TEXT"); + + b.Property("Value_XML") + .HasColumnType("TEXT"); + + b.HasKey("DeviceId", "KeyName", "DateTime"); + + b.HasIndex("DeviceId"); + + b.HasIndex("KeyName"); + + b.HasIndex("DeviceId", "KeyName"); + + b.HasIndex("DeviceId", "KeyName", "DateTime"); + + b.ToTable("TelemetryData"); + }); + + modelBuilder.Entity("IoTSharp.Data.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("TEXT"); + + b.Property("Address") + .HasColumnType("TEXT"); + + b.Property("City") + .HasColumnType("TEXT"); + + b.Property("Country") + .HasColumnType("TEXT"); + + b.Property("EMail") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Phone") + .HasColumnType("TEXT"); + + b.Property("Province") + .HasColumnType("TEXT"); + + b.Property("Street") + .HasColumnType("TEXT"); + + b.Property("ZipCode") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Tenant"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("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", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("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.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", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", 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", 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 + } + } +} diff --git a/IoTSharp.Data.Sqlite/SqliteModelBuilderOptions.cs b/IoTSharp.Data.Sqlite/SqliteModelBuilderOptions.cs new file mode 100644 index 0000000000000000000000000000000000000000..979c57bed0e060342fab431686369781f11b658c --- /dev/null +++ b/IoTSharp.Data.Sqlite/SqliteModelBuilderOptions.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using System; + +namespace IoTSharp.Data.Sqlite +{ + public class SqliteModelBuilderOptions : IDataBaseModelBuilderOptions + { + public SqliteModelBuilderOptions() + { + } + + public IInfrastructure Infrastructure { get; set; } + + public void OnModelCreating(ModelBuilder modelBuilder) + { + + } + } +} \ No newline at end of file diff --git a/IoTSharp.Data/Enums.cs b/IoTSharp.Data/Enums.cs index 41640eab88dd04c9ef58c6a1369b166b920cf15b..382d0d663c2951d0012bc62b9366b05d9d2c7471 100644 --- a/IoTSharp.Data/Enums.cs +++ b/IoTSharp.Data/Enums.cs @@ -77,7 +77,7 @@ namespace IoTSharp.Data SqlServer, MySql , Oracle , - SQLite + Sqlite } [JsonConverter(typeof(StringEnumConverter))] public enum IdentityType diff --git a/IoTSharp.Data/TelemetryDataConfiguration.cs b/IoTSharp.Data/TelemetryDataConfiguration.cs index 06653fbe515475f7921b26562c32c5b73b386524..d607b327cd581cd48d8fc394d217d067d026fa7f 100644 --- a/IoTSharp.Data/TelemetryDataConfiguration.cs +++ b/IoTSharp.Data/TelemetryDataConfiguration.cs @@ -18,7 +18,6 @@ namespace IoTSharp.Data builder.HasIndex(c => new { c.DeviceId }); builder.HasIndex(c => new { c.DeviceId, c.KeyName }); builder.HasIndex(c => new { c.KeyName }); - builder.HasIndex(c => new { c.DeviceId, c.KeyName, c.DateTime }); builder.HasKey(c => new { c.DeviceId, c.KeyName, c.DateTime }); builder.Property(t => t.DeviceId) .IsRequired(); diff --git a/IoTSharp.sln b/IoTSharp.sln index fd2b480ab44f42934b1842883fe2fd5c268b197a..17836366cfcce1bd612c9b2ab008884d3bd36c50 100644 --- a/IoTSharp.sln +++ b/IoTSharp.sln @@ -33,6 +33,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{3048484A-6A46-4E17-825C-D2C59D6D30ED}" ProjectSection(SolutionItems) = preProject buildimage.cmd = buildimage.cmd + tools\ef_db_drop.cmd = tools\ef_db_drop.cmd tools\ef_mg_add.cmd = tools\ef_mg_add.cmd tools\upgrade_ef.cmd = tools\upgrade_ef.cmd EndProjectSection @@ -49,7 +50,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data", "IoTSharp.D EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.MySQL", "IoTSharp.Data.MySQL\IoTSharp.Data.MySQL.csproj", "{233F2C8D-DD4C-49B7-99A2-F3DB5620DEFB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IoTSharp.Data.SqlServer", "IoTSharp.Data.SqlServer\IoTSharp.Data.SqlServer.csproj", "{1B3287BE-4FC5-45C7-BA45-D6A3A92D30C8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.SqlServer", "IoTSharp.Data.SqlServer\IoTSharp.Data.SqlServer.csproj", "{1B3287BE-4FC5-45C7-BA45-D6A3A92D30C8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.Oracle", "IoTSharp.Data.Oracle\IoTSharp.Data.Oracle.csproj", "{7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IoTSharp.Data.Sqlite", "IoTSharp.Data.Sqlite\IoTSharp.Data.Sqlite.csproj", "{C4450C7C-DD38-47A2-90C7-3F774B09CD69}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -320,6 +325,46 @@ Global {1B3287BE-4FC5-45C7-BA45-D6A3A92D30C8}.Release|x64.Build.0 = Release|Any CPU {1B3287BE-4FC5-45C7-BA45-D6A3A92D30C8}.Release|x86.ActiveCfg = Release|Any CPU {1B3287BE-4FC5-45C7-BA45-D6A3A92D30C8}.Release|x86.Build.0 = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|ARM.ActiveCfg = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|ARM.Build.0 = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|ARM64.Build.0 = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|x64.ActiveCfg = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|x64.Build.0 = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|x86.ActiveCfg = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Debug|x86.Build.0 = Debug|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|Any CPU.Build.0 = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|ARM.ActiveCfg = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|ARM.Build.0 = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|ARM64.ActiveCfg = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|ARM64.Build.0 = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|x64.ActiveCfg = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|x64.Build.0 = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|x86.ActiveCfg = Release|Any CPU + {7EE009F2-4B7F-49DB-86D8-ED60D6787DB2}.Release|x86.Build.0 = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|ARM.ActiveCfg = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|ARM.Build.0 = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|ARM64.Build.0 = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|x64.ActiveCfg = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|x64.Build.0 = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|x86.ActiveCfg = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Debug|x86.Build.0 = Debug|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|Any CPU.Build.0 = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|ARM.ActiveCfg = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|ARM.Build.0 = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|ARM64.ActiveCfg = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|ARM64.Build.0 = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|x64.ActiveCfg = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|x64.Build.0 = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|x86.ActiveCfg = Release|Any CPU + {C4450C7C-DD38-47A2-90C7-3F774B09CD69}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/IoTSharp/Extensions/IoTSharpExtension.cs b/IoTSharp/Extensions/IoTSharpExtension.cs index 8cc91637877923ff2bc3a847288a75bd14e35447..34dfe4ac17fa99fa1e8c3760fbcf4f038546e0f9 100644 --- a/IoTSharp/Extensions/IoTSharpExtension.cs +++ b/IoTSharp/Extensions/IoTSharpExtension.cs @@ -53,7 +53,7 @@ namespace IoTSharp return ts.Include(ak => ak.Tenant).Where(ak => ak.Tenant.Id.ToString() == _tenantId); } public static Customer GetCustomer(this ApplicationDbContext context, string custid) - => context.Customer.Include(c => c.Tenant).FirstOrDefault(c => c.Id.ToString() == custid); + => context.Customer.Include(c => c.Tenant).FirstOrDefault(c => c.Id == Guid.Parse( custid)); public static string GetCustomerId(this ControllerBase controller) { diff --git a/IoTSharp/IoTSharp.csproj b/IoTSharp/IoTSharp.csproj index 0cc16376873c88daf05f2a565c9b14fdaa205648..e45c3f3d7c2c5e530d9efa8ae400e8ded7008c31 100644 --- a/IoTSharp/IoTSharp.csproj +++ b/IoTSharp/IoTSharp.csproj @@ -46,9 +46,6 @@ - - - @@ -93,7 +90,6 @@ - @@ -126,7 +122,10 @@ + + + <_WebToolingArtifacts Remove="Properties\PublishProfiles\registry.hub.docker.com_iotsharp.pubxml" /> True @@ -139,7 +138,9 @@ + + diff --git a/IoTSharp/Startup.cs b/IoTSharp/Startup.cs index 0addaf4b2c692d435d34f101b8ba37d49eaa851f..913a02b1b1a50b75b0eb4b59b5813026be7365fb 100644 --- a/IoTSharp/Startup.cs +++ b/IoTSharp/Startup.cs @@ -98,6 +98,12 @@ namespace IoTSharp case DataBaseType.SqlServer: services.ConfigureSqlServer(Configuration.GetConnectionString("IoTSharp"), settings.DbContextPoolSize, healthChecks, healthChecksUI); break; + case DataBaseType.Oracle: + services.ConfigureOracle(Configuration.GetConnectionString("IoTSharp"), settings.DbContextPoolSize, healthChecks, healthChecksUI); + break; + case DataBaseType.Sqlite: + services.ConfigureSqlite(Configuration.GetConnectionString("IoTSharp"), settings.DbContextPoolSize, healthChecks, healthChecksUI); + break; case DataBaseType.PostgreSql: default: services.ConfigureNpgsql(Configuration.GetConnectionString("IoTSharp"), settings.DbContextPoolSize, healthChecks, healthChecksUI); @@ -206,6 +212,12 @@ namespace IoTSharp case DataBaseType.SqlServer: config.UseSqlServerToSharding(Configuration.GetConnectionString("TelemetryStorage"), settings.Sharding.ExpandByDateMode); break; + case DataBaseType.Oracle: + config.UseOracleToSharding(Configuration.GetConnectionString("TelemetryStorage"), settings.Sharding.ExpandByDateMode); + break; + case DataBaseType.Sqlite: + config.UseSQLiteToSharding(Configuration.GetConnectionString("TelemetryStorage"), settings.Sharding.ExpandByDateMode); + break; case DataBaseType.PostgreSql: default: config.UseNpgsqlToSharding(Configuration.GetConnectionString("TelemetryStorage"), settings.Sharding.ExpandByDateMode); diff --git a/IoTSharp/appsettings.Oracle.json b/IoTSharp/appsettings.Oracle.json new file mode 100644 index 0000000000000000000000000000000000000000..3b816fcc0dbb334f3e3918d940db030061a65327 --- /dev/null +++ b/IoTSharp/appsettings.Oracle.json @@ -0,0 +1,24 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + }, + //https://blog.csdn.net/qq_35035078/article/details/88855621 + "DataBase": "Oracle", + "ConnectionStrings": { + "IoTSharp": "DATA SOURCE=127.0.0.1:1521/xe;PASSWORD=oracle;PERSIST SECURITY INFO=True;USER ID=SYSTEM;", + "EventBusStore": "mongodb://root:kissme@mongodb:27017", + "TelemetryStorage": "DATA SOURCE=127.0.0.1:1521/xe;PASSWORD=oracle;PERSIST SECURITY INFO=True;USER ID=SYSTEM;", + "EventBusMQ": "amqp://root:kissme@rabbitmq:5672" + }, + "JwtKey": "kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme", + "JwtExpireHours": 24, + "JwtIssuer": "IoTSharp.Net", + "JwtAudience": "IoTSharp.Net", + "EventBusStore": "InMemory", + "EventBusMQ": "InMemory", + "TelemetryStorage": "Sharding" +} \ No newline at end of file diff --git a/IoTSharp/appsettings.Sqlite.json b/IoTSharp/appsettings.Sqlite.json new file mode 100644 index 0000000000000000000000000000000000000000..256e60a28a88a7b0e158978b3b9ebd6943ed5d67 --- /dev/null +++ b/IoTSharp/appsettings.Sqlite.json @@ -0,0 +1,23 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + }, + "DataBase": "Sqlite", + "ConnectionStrings": { + "IoTSharp": "Data Source=IoTSharp.db", + "EventBusStore": "mongodb://root:kissme@mongodb:27017", + "TelemetryStorage": "Data Source=TelemetryStorage.db", + "EventBusMQ": "amqp://root:kissme@rabbitmq:5672" + }, + "JwtKey": "kissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissmekissme", + "JwtExpireHours": 24, + "JwtIssuer": "IoTSharp.Net", + "JwtAudience": "IoTSharp.Net", + "EventBusStore": "InMemory", + "EventBusMQ": "InMemory", + "TelemetryStorage": "Sharding" +} \ No newline at end of file diff --git a/tools/ef_db_drop.cmd b/tools/ef_db_drop.cmd new file mode 100644 index 0000000000000000000000000000000000000000..f2de81bd2e1898052f18a628d4da4123b632befe --- /dev/null +++ b/tools/ef_db_drop.cmd @@ -0,0 +1,5 @@ +echo off +cls +echo Drop to IoTSharp.Data.%1 +set ASPNETCORE_ENVIRONMENT=%1 +dotnet ef database drop --context IoTSharp.Data.ApplicationDbContext --startup-project ..\IoTSharp\IoTSharp.csproj --project ..\IoTSharp.Data.%1\IoTSharp.Data.%1.csproj \ No newline at end of file diff --git a/tools/ef_mg_add.cmd b/tools/ef_mg_add.cmd index 813405cab60bbd69f0afbf95108c53e8ac50a15f..2bfa48281b02789909430bd9d8d554c4ee4f437e 100644 --- a/tools/ef_mg_add.cmd +++ b/tools/ef_mg_add.cmd @@ -1,4 +1,5 @@ +echo off +cls echo Add a migration name is %2 to IoTSharp.Data.%1 -cd IoTSharp.Data.%1 set ASPNETCORE_ENVIRONMENT=%1 dotnet ef migrations add %2 --context IoTSharp.Data.ApplicationDbContext --startup-project ..\IoTSharp\IoTSharp.csproj --project ..\IoTSharp.Data.%1\IoTSharp.Data.%1.csproj \ No newline at end of file