implicit operator 与 explicit operator
在C#中,implicit operator 和 explicit operator 都用于用户定义的类型转换,但它们在转换方式和安全性上有重要区别。
在C#中,implicit operator 和 explicit operator 都用于用户定义的类型转换,但它们在转换方式和安全性上有重要区别。
原因在于每个扇区的物理字节数。
使用以下命令可以查看:
fsutil fsinfo sectorinfo c:LogicalBytesPerSector : 512
PhysicalBytesPerSectorForAtomicity : 32768
PhysicalBytesPerSectorForPerformance : 32768
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
设备校准 : 已校准(0x000)
设备上的分区校准: 已校准(0x000)
无搜寻惩罚
支持剪裁
不支持 DAX
未精简预配这两个32768是导致sqlserver出错的原因。
解决方案就是执行以下命令:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\stornvme\Parameters\Device" /v "ForcedPhysicalSectorSizeInBytes" /t reg_multi_sz /d "* 4095" /f重启之后再查看结果:
LogicalBytesPerSector : 512
PhysicalBytesPerSectorForAtomicity : 4096
PhysicalBytesPerSectorForPerformance : 4096
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
设备校准 : 已校准(0x000)
设备上的分区校准: 已校准(0x000)
无搜寻惩罚
支持剪裁
不支持 DAX
未精简预配 取消默认可查看任何数据库
DENY VIEW any DATABASE TO PUBLIC;赋予自己拥有管理权限的数据库的查看权限
ALTER AUTHORIZATION ON DATABASE::[Database] TO [User];注意:如果数据库已存在用户权限,则可能要删除后再操作
如果需要该用户可以使用SQL Profiler来跟踪SQL,则需要执行:
GRANT ALTER TRACE TO [USER]注意:此命令将使该用户跟踪所有SQL,包括未授权的数据库。
一般的ID、Name:
new TableDaoRelationship(nameof(PayOrder.User), UserDAO.Instance.TableName)一般的ID、Name、Value:
new TableDaoRelationship(nameof(PayOrder.Merchant), MerchantDAO.Instance.TableName).SetOtherFiledsAsIdNameValue(nameof(Merchant.Name), nameof(Merchant.MchId))一般的ID、Value:
new TableDaoRelationship(nameof(PayOrder.ProfitSharingPlanOrder), ProfitSharingPlanOrderDAO.Instance.TableName).SetOtherFiledsAsIdValue(nameof(ProfitSharingPlanOrder.Status))主表ID和关联表ID
重点在于:SetSelfFieldAlias
new TableDaoRelationship(nameof(PayOrder.ID), PayOrderTransactionDAO.Instance.TableName).SetSelfFieldAlias(nameof(PayOrder.Transaction)).SetOtherFileds(typeof(PayOrderTransactionInfo))指定关联表别名
一般用于查询时需要使用关联表栏位作为查询条件
重点在于:SetOtherTableAlias,使用时在生成查询条件时要指定Field。
new TableDaoRelationship(nameof(PayOrder.ID), PayOrderTransactionDAO.Instance.TableName).SetSelfFieldAlias(nameof(PayOrder.Transaction)).SetOtherTableAlias(nameof(SQMIS.Model.PayOrderTransaction)).SetOtherFileds(typeof(PayOrderTransactionInfo)).AppendEqual(new Field(nameof(SQMIS.Model.PayOrderTransaction), nameof(SQMIS.Model.PayOrderTransaction.TransactionId)), this.TransactionID)多重关联时使用SetMoreLogicExpressions,可使用self和other来代替两个表的别名:
new TableDaoRelationship(nameof(User.Principal), "RBAC_UserPrincipal").SetOtherFiledsAsIdNameValue("Name", "OuterID").SetMoreLogicExpressions(LogicExpression.BuildEqual(new Field("self", "Type"), new Field("other", "Type")))计算机配置->管理模板->网络->Lanman 工作站->双击右边的”启用不安全的来宾登录“,然后点击“已启用”