Update demo

This commit is contained in:
sunkaixuan 2019-06-04 16:03:25 +08:00
parent 15616575dc
commit a095ed39a6
5 changed files with 13 additions and 1 deletions

View File

@ -6,6 +6,7 @@ using System.Data.SQLite;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace SqlSugar
{
@ -264,6 +265,16 @@ namespace SqlSugar
/// <returns></returns>
public override bool CreateDatabase(string databaseName, string databaseDirectory = null)
{
var connString=this.Context.CurrentConnectionConfig.ConnectionString;
var path = Regex.Match(connString, @"[a-z,A-Z]\:\\.+\\").Value;
if (path.IsNullOrEmpty())
{
path = Regex.Match(connString, @"[a-z,A-Z]\:\/.+\/").Value;
}
if (!FileHelper.IsExistDirectory(path))
{
FileHelper.CreateDirectory(path);
}
this.Context.Ado.Connection.Open();
this.Context.Ado.Connection.Close();
return true;
@ -289,6 +300,7 @@ namespace SqlSugar
}
private List<DbColumnInfo> GetColumnsByTableName(string tableName)
{
tableName = SqlBuilder.GetTranslationTableName(tableName);
string sql = "select * from " + tableName + " limit 0,1";
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
this.Context.Ado.IsEnableLogEvent = false;

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -123,7 +123,7 @@ namespace OrmTest
Console.WriteLine("");
Console.WriteLine("#### SqlFunc Start ####");
var db = GetInstance();
var index= db.Queryable<Order>().Select(it => SqlFunc.CharIndex("a", "cccacc")).First();
var index= db.Queryable<Order>().Select(it => SqlFunc.Contains("a", "cccacc")).First();
Console.WriteLine("#### SqlFunc End ####");
}