Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/NewLifeX/X
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Sep 10, 2016
2 parents 10fd9a7 + e126af5 commit 863fdbc
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 35 deletions.
5 changes: 2 additions & 3 deletions NewLife.Core/Log/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ public LogLevel Level
#endregion

#region 静态空实现
private static ILog _Null = new NullLogger();
/// <summary>空日志实现</summary>
public static ILog Null { get { return _Null; } }
public static ILog Null { get; } = new NullLogger();

class NullLogger : Logger
{
Expand Down Expand Up @@ -242,6 +241,6 @@ protected static String GetHead()

return sb.ToString();
}
#endregion
#endregion
}
}
2 changes: 1 addition & 1 deletion NewLife.Core/Net/NetUri.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public NetUri Parse(String uri)

// 分析协议
var p = uri.IndexOf(Sep);
if (p > 0)
if (p >= 0)
{
Protocol = uri.Substring(0, p);
uri = uri.Substring(p + Sep.Length);
Expand Down
12 changes: 12 additions & 0 deletions NewLife.Core/NewLife.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@
<Compile Include="Reflection\Reflect.cs" />
<Compile Include="Reflection\OrcasNamer.cs" />
<Compile Include="Reflection\ScriptEngine.cs" />
<Compile Include="Remoting\IApi.cs" />
<Compile Include="Remoting\IApiClient.cs" />
<Compile Include="Remoting\IApiServer.cs" />
<Compile Include="Remoting\IApiSession.cs" />
<Compile Include="Remoting\ApiClient.cs" />
<Compile Include="Remoting\ApiHttpClient.cs" />
<Compile Include="Remoting\ApiHttpServer.cs" />
<Compile Include="Remoting\ApiNetClient.cs" />
<Compile Include="Remoting\ApiNetServer.cs" />
<Compile Include="Remoting\ApiServer.cs" />
<Compile Include="Remoting\ApiTest.cs" />
<Compile Include="Remoting\IEncoder.cs" />
<Compile Include="Security\Certificate.cs" />
<Compile Include="Security\Crc16.cs" />
<Compile Include="Security\DSAHelper.cs" />
Expand Down
8 changes: 3 additions & 5 deletions NewLife.Cube/Common/HtmlExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static MvcHtmlString ForEditor(this HtmlHelper Html, FieldItem field, IEn

if (field.ReadOnly)
{
var label = "<label class=\"control-label\">{0}</label>".F(entity[field.Name]);
var label = "<label class=\"form-control\">{0}</label>".F(entity[field.Name]);
return new MvcHtmlString(label);
}

Expand Down Expand Up @@ -365,12 +365,10 @@ public static MvcHtmlString ForDouble(this HtmlHelper Html, String name, Double
{
var atts = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
if (!atts.ContainsKey("class")) atts.Add("class", "form-control");

// 首先输出图标
var ico = Html.Raw("<span class=\"input-group-addon\"><i class=\"glyphicon glyphicon-yen\"></i></span>");

var txt = Html.TextBox(name, value, format, atts);

return new MvcHtmlString(ico.ToString() + txt);
return txt;
}
#endregion

Expand Down
7 changes: 3 additions & 4 deletions NewLife.Cube/Web.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="webpages:Version" value="2.0.0.0"/>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="PreserveLoginUrl" value="true"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
Expand All @@ -19,7 +18,7 @@
<!--<add name="Membership" connectionString="Server=.;Port=3306;Database=Membership;Uid=root;Pwd=root;" providerName="MySql.Data.MySqlClient"/>-->
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<compilation debug="true" targetFramework="4.5"/>
<authentication mode="Forms">
<forms loginUrl="~/Admin/User/Login" timeout="2880"/>
</authentication>
Expand All @@ -32,7 +31,7 @@
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
<httpRuntime requestValidationMode="2.0"/>
<httpRuntime targetFramework="4.5" requestValidationMode="2.0"/>
<httpModules>
<!--全局错误处理模块-->
<add name="ErrorModule" type="NewLife.Web.ErrorModule,NewLife.Core"/>
Expand Down
2 changes: 1 addition & 1 deletion XCode/Configuration/FieldItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public Expression NotIn(SelectBuilder builder)
{
if (builder == null) return new Expression();

return CreateFormatExpression("{0} NotIn({1})", builder);
return CreateFormatExpression("{0} NOT IN ({1})", builder);
}

/// <summary>IsNull操作,不为空,一般用于字符串,但不匹配0长度字符串</summary>
Expand Down
3 changes: 0 additions & 3 deletions XCode/Configuration/TableItem.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Reflection;
using System.Xml.Serialization;
using NewLife.Collections;
using NewLife.Configuration;
using XCode.DataAccessLayer;

namespace XCode.Configuration
Expand Down
1 change: 0 additions & 1 deletion XCode/Entity/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Text;
using System.Text.RegularExpressions;
using NewLife.Data;
using NewLife.IO;
using NewLife.Reflection;
using NewLife.Serialization;
using NewLife.Xml;
Expand Down
24 changes: 7 additions & 17 deletions XCode/Entity/EntitySession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
using System.Web;
using NewLife;
using NewLife.Collections;
using NewLife.Configuration;
using NewLife.Log;
using NewLife.Threading;
using XCode.Cache;
using XCode.Configuration;
using XCode.DataAccessLayer;
Expand Down Expand Up @@ -352,7 +350,7 @@ public EntityCache<TEntity> Cache
// 从默认会话复制参数
if (Default != this) ec.CopySettingFrom(Default.Cache);
//_cache = ec;
Interlocked.CompareExchange<EntityCache<TEntity>>(ref _cache, ec, null);
Interlocked.CompareExchange(ref _cache, ec, null);
}
return _cache;
}
Expand All @@ -376,7 +374,7 @@ public ISingleEntityCache<Object, TEntity> SingleCache
// 从默认会话复制参数
if (Default != this) sc.CopySettingFrom(Default.SingleCache);

Interlocked.CompareExchange<ISingleEntityCache<Object, TEntity>>(ref _singleCache, sc, null);
Interlocked.CompareExchange(ref _singleCache, sc, null);
}
return _singleCache;
}
Expand Down Expand Up @@ -415,7 +413,7 @@ public Int64 LongCount
if (n >= 0)
{
// 等于0的时候也应该缓存,否则会一直查询这个表
if (n < 1000L) { return n; }
if (n < 1000L) return n;

// 大于1000,使用HttpCache
Int64? k = (Int64?)HttpRuntime.Cache[key];
Expand All @@ -427,13 +425,13 @@ public Int64 LongCount

Int64 m = 0L;
// 小于1000的精确查询,大于1000的快速查询
if (n > -1L && n <= 1000L)
if (n >= 0 && n <= 1000L)
{
var sb = new SelectBuilder();
sb.Table = FormatedTableName;

WaitForInitData();
m = Dal.SelectCount(sb, new String[] { TableName });
m = Dal.SelectCount(sb, TableName);
}
else
{
Expand Down Expand Up @@ -718,8 +716,7 @@ public virtual Int32 Truncate(String sql)
}

ClearCache("TRUNCATE TABLE");
if (_OnDataChange != null) { _OnDataChange(ThisType); }

_OnDataChange?.Invoke(ThisType);
return rs;
}

Expand Down Expand Up @@ -844,7 +841,7 @@ private void DataChange(String reason, Boolean forceClearCache, Boolean isUpdate
ForceClearCache(String.Format("{0}(F{1}-U{2})", reason, forceClearCache ? 1 : 0, isUpdateMode ? 1 : 0), isUpdateMode);
}

if (_OnDataChange != null) { _OnDataChange(ThisType); }
_OnDataChange?.Invoke(ThisType);
}

private Action<Type> _OnDataChange;
Expand Down Expand Up @@ -1097,15 +1094,9 @@ public virtual Int32 Delete(IEntity entity)
return rs;
}
#endregion

//#region 队列
///// <summary>实体队列</summary>
//public EntityQueue Queue { get; private set; }
//#endregion
}

#region 脏实体会话

/// <summary>脏实体会话,嵌套事务回滚时使用</summary>
/// <remarks>http://www.newlifex.com/showtopic-1216.aspx</remarks>
public class DirtiedEntitySession
Expand All @@ -1126,6 +1117,5 @@ internal DirtiedEntitySession(IEntitySession session, Int32 executeCount, Int32
DirectExecuteSQLCount = directExecuteSQLCount;
}
}

#endregion
}

0 comments on commit 863fdbc

Please sign in to comment.