The current version is in Beta, do not use in commercial environment.
- DBSearch Sql Server Easy Search Demo | .NET Fiddle
- DBSearch Online Demo : Search Details | .NET Fiddle
- Mini、Easy(Just need to understand
Search
method) - support
net45;net451;net46;netstandard2.0;
- support mutilple Connection faster query
- auto get match database type
- Support SQL Server、Oracle、SQLite、MySQL、PGSQL、Firebird
You can install the package from NuGet using the Visual Studio Package Manager or NuGet UI:
PM> install-package DBSearch
or dotnet
command line:
dotnet add package DBSearch
using (var connection = GetConnection())
{
var result = connection.Search("your search data");
}
using (var connection = GetConnection())
{
var data = connection.Search("%Test%");
}
e.g : Create 10 connection to speed up the query.
var data = connection.Search("Test",connectionCount : 10);
p.s : if connection string use password then it have to add connectionString parameter. ConnectionString loses password when connection open
var data = connection.Search("Test",connectionCount : 10,connectionString : @"Data Source=192.168.1.1;User ID=sa;Password=123456;Initial Catalog=master;");
Eidt all database someone value
For example, change the "Hello Gitlab" value of the entire database to "Hello Github", and please make sure to backup and Log it.
Replace("Hello Gitlab","Hello Github");
static void Replace(object replaceValue,object newValue)
{
using (var scope = new System.Transactions.TransactionScope())
using (var connection = GetConnection())
{
//Log Action
connection.Search(replaceValue, (result) =>
{
var sql = $"Update {result.TableName} set {result.ColumnName} = @newValue where {result.ColumnName} = @replaceValue";
connection.Execute(sql, new { replaceValue, newValue }); //Using Dapper ORM
});
scope.Complete();
}
}
string
connection.Search("Test");
Datetime
connection.Search(DateTime.Parse("2019/1/2 03:04:05"));
float
connection.Search(1.2);
int、Boolean、Decimal、Guid
connection.Search(123);
connection.Search(true);
connection.Search(decimal.Parse("0.123"));
connection.Search(new Guid("219f7ef5-f4bd-4e9a-a9f6-1f127122d004"));