小编Iva*_*van的帖子

解析变量在 SQL 中的等于运算符错误中不兼容

我在 django 中收到以下错误model.objects.get_or_create

SQLServer [FreeTDS][SQL Server]The data types nvarchar(max) and ntext
are incompatible in the equal to operator.
Run Code Online (Sandbox Code Playgroud)

列 django 抱怨NVARCHAR(MAX)SQLServer 中允许为 null。

Django 模型元素定义为 TextField(null=True)

python django sql-server-2012

8
推荐指数
1
解决办法
424
查看次数

具有复杂类型集合的 C# odata 操作失败

我需要调用一个公开操作的服务器。此操作具有复杂类型集合的字符串或复杂类型集合作为参数。我也需要打电话。

元数据是:

任何一个:

<Action Name="BulkChange" IsBound="true">
<Parameter Name="bindingParameter" Type="Collection(PropertyCore.InspectionDuty)"/>
<Parameter Name="Comment" Type="Edm.String" Unicode="false"/>
<Parameter Name="Changes" Type="Collection(PropertyCore.InspectionDutyChange)"/>
</Action>
Run Code Online (Sandbox Code Playgroud)

具有以下复杂类型:

<ComplexType Name="InspectionDutyChange">
<Property Name="Operation" Type="Operations.Operations" Nullable="false"/>
<Property Name="Identity" Type="Edm.Guid" Nullable="false"/>
<Property Name="IsDisabled" Type="Edm.Boolean" Nullable="false"/>
<Property Name="SeriesStart" Type="Edm.DateTimeOffset"/>
<Property Name="Interval" Type="Common.Interval"/>
<NavigationProperty Name="Module" Type="PropertyCore.Module"/>
<NavigationProperty Name="Equipment" Type="PropertyCore.Equipment"/>
<NavigationProperty Name="OperatorTask" Type="PropertyCore.OperatorTask"/>
</ComplexType>
Run Code Online (Sandbox Code Playgroud)

或者,或者:

<Action Name="BulkChange" IsBound="true">
<Parameter Name="bindingParameter" Type="Collection(PropertyCore.InspectionDuty)"/>
<Parameter Name="Updates" Type="PropertyCore.InspectionDutyChanges"/>
</Action>
Run Code Online (Sandbox Code Playgroud)

复杂类型定义为

<ComplexType Name="InspectionDutyChanges">
<Property Name="Comment" Type="Edm.String"/>
<Property Name="Changes" Type="Collection(PropertyCore.InspectionDutyChange)"/>
</ComplexType>

<ComplexType Name="InspectionDutyChange">
<Property Name="Operation" Type="Operations.Operations" Nullable="false"/>
<Property Name="Identity" Type="Edm.Guid" Nullable="false"/>
<Property …
Run Code Online (Sandbox Code Playgroud)

c# odata odatalib

5
推荐指数
1
解决办法
590
查看次数

避免 .Net Standard 中的非跨平台依赖关系

我将现有库从 .Net Framework 4.7.2 移植到 .Net Standard 2.0,以使其跨平台,但仍保留与 .Net Framework 应用程序的兼容性。

我不明白如何避免非跨平台依赖关系

我的库使用动态类型Settings.Designer.cs。

为了在 .Net Standard 中支持它,我必须添加对NuGet包的引用,这反过来又添加了对其他一些包(如 )的依赖项,即使我不使用任何与安全相关的代码。Microsoft.CSharpSystem.Configuration.ConfigurationManagerSystem.Security.Principal.Windows

最后两个显然是Microsoft.Windows.Compatibility包的一部分。

NuGet 依赖项

  1. 如何查明这些依赖项是否跨平台(即 Windows 平台扩展的一部分)?

当我转到.NET API 浏览器时,我看到它Microsoft.Csharp不在 .Net Standard 2.0 中,但它在 .Net Platform Extensions 2.1 及更高版本中。这是否意味着这个包不是跨平台的?是否有其他服务可以检查 NuGet 包的平台支持?

.NEt API 结果

  1. 当我在 .Net Core 2.1 上使用我的库创建一个简单的测试应用程序并将其发布到 Linux 平台时dotnet publish -c Release --self-contained true --runtime linux-x64,该应用程序实际上在 Linux 计算机上运行良好。这是否意味着我的库是完全跨平台的,我可以在生产中安全地使用它,或者我System.PlatformNotSupportedException将来可能仍然会在 Linux 上遇到?

c# cross-platform .net-standard

5
推荐指数
0
解决办法
134
查看次数