小编use*_*725的帖子

Sql server奇怪的身份增量

我在SQL Azure上安装了这个表

CREATE TABLE [dbo].[Sl](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [PublicId] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PrimaryKey_ba033f1f-ac1b-4616-8591-fcd47fe0f63d] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON),
 CONSTRAINT [PublicId_UNIQUE] UNIQUE NONCLUSTERED 
(
    [PublicId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
)
Run Code Online (Sandbox Code Playgroud)

非常奇怪的是,ID会以意想不到的方式递增.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 …
Run Code Online (Sandbox Code Playgroud)

sql-server azure-sql-database

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

NLog不写调试消息

在我的代码中,我有一些信息消息,如logger.Log("dwewe")logger.Debug("ddddf").

问题是即使我在VS中调试,也没有写入Debug消息.

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      throwExceptions="true"
      internalLogLevel="Trace"
      internalLogFile="c:\nlog-app.log"
      autoReload="false"
      internalLogToConsole="true">
  <!--
  See http://nlog-project.org/wiki/Configuration_file
  for information on customizing logging rules and outputs.
   -->
  <targets>
    <!-- file targets -->
    <target name="asyncFile" xsi:type="AsyncWrapper">
      <target xsi:type="File" name="f" fileName="${basedir}/Logs/${shortdate}.log"
            layout="${longdate} ${uppercase:${level}} ${message} ${event-context:item=error-source} ${event-context:item=error-class} ${event-context:item=error-method} ${event-context:item=error-message} ${event-context:item=inner-error-message} ${event-context:item=stack-trace}"/>
    </target>

    <!-- database targets -->
    <target name="database" xsi:type="Database" keepConnection="true" useTransactions="true"
             dbProvider="System.Data.SqlClient"
             connectionString="data source=XXXXXX.database.windows.net;initial catalog=NLog;integrated security=false;persist security info=True;User ID=XXXXr;Password=BXXXX3"
              commandText="INSERT INTO Logs(EventDateTime, EventLevel, UserName, MachineName, EventMessage, ErrorSource, ErrorClass, ErrorMethod, ErrorMessage, …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net asp.net-mvc nlog

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

反序列化数据库多个名称

我有这个名为1_method的文件

public class DerivedClass
{

    [DataMember(Name="1_method")]
    public virtual string FirstMethod { get; protected set; }

}
Run Code Online (Sandbox Code Playgroud)

当我反序列化json时,我需要它可以映射到各种名称.
我怎样才能实现类似下面的伪代码?

public class DerivedClass
{

    [DataMember(Name="1_method",Name="2_method")]
    public virtual string FirstMethod { get; protected set; }

}
Run Code Online (Sandbox Code Playgroud)

或者像这样:

public class DerivedClass
{

    [DataMember(Name="1_method")]
   [DataMember(Name="2_method")]
    public virtual string FirstMethod { get; protected set; }

}
Run Code Online (Sandbox Code Playgroud)

.net serialization json

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