PromptSql 0.0.1
Additional Details
no support will be provided for this package.
dotnet add package PromptSql --version 0.0.1
NuGet\Install-Package PromptSql -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PromptSql" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PromptSql --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PromptSql, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PromptSql as a Cake Addin #addin nuget:?package=PromptSql&version=0.0.1 // Install PromptSql as a Cake Tool #tool nuget:?package=PromptSql&version=0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PromptSql
This library was developed to present your basic ado net operations with a simple fluent interface.
How to use?
1. Create a PromptSqlModule
public class SqlModule : PromptSqlModule
{
public override string GetConnectionString()
{
return ConfigurationManager.AppSettings["DefaultConnection"];
}
}
2. Command usage
string sqlCommand = @"UPDATE [dbo].[Books] SET [Description] = 'Test Description' WHERE [Id] = 1";
new SqlOperations<SqlModule>()
.BeginOperation(x => x.CreateOptions(sqlCommand))
.GetCommand()
.ExecuteNonQuery();
3. Query usage
In order to make inquiries, you must first have a model where you will host the data and a sqlmapper.
get the model as below
public class Book
{
public int Id { get; set; }
public string ISBN { get; set; }
public string Description { get; set; }
public int? Age { get; set; }
public DateTime? CreateDate { get; set; }
}
sqlmapper for this model should be as follows
public class BookMapper : SqlMapper<Book>
{
protected override Book Map(DataRow source)
{
return new Book
{
Id = source.Field<int>("Id"),
ISBN = source.Field<string>("ISBN"),
Age = source.Field<int?>("Age"),
CreateDate = source.Field<DateTime?>("CreateDate"),
Description = source.Field<string>("Description")
};
}
}
now we are ready to query
var data = new SqlOperations<SqlModule>()
.BeginOperation(x => x.CreateOptions(query))
.GetQuery<Book, BookMapper>()
.GetData();
that's all
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net452 is compatible. net46 is compatible. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.5.2
- System.Data.SqlClient (>= 4.8.0)
-
.NETFramework 4.6
- System.Data.SqlClient (>= 4.8.0)
-
.NETFramework 4.7.2
- System.Data.SqlClient (>= 4.8.0)
-
.NETFramework 4.8
- System.Data.SqlClient (>= 4.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.0.1 | 960 | 1/19/2020 |
This library was developed to present your basic ado net operations with a simple fluent interface.