Browse Source

Update demo

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
a095ed39a6
  1. 12
      Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs
  2. BIN
      Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite
  3. BIN
      Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite
  4. BIN
      Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite
  5. 2
      Src/Asp.Net/SqliteTest/Demo/Demo1_Queryable.cs

12
Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs

@ -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;

BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite

Binary file not shown.

BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite

Binary file not shown.

BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite

Binary file not shown.

2
Src/Asp.Net/SqliteTest/Demo/Demo1_Queryable.cs

@ -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 ####");
}

Loading…
Cancel
Save