MsSql.Adapter.Generator 1.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package MsSql.Adapter.Generator --version 1.0.4                
NuGet\Install-Package MsSql.Adapter.Generator -Version 1.0.4                
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="MsSql.Adapter.Generator" Version="1.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MsSql.Adapter.Generator --version 1.0.4                
#r "nuget: MsSql.Adapter.Generator, 1.0.4"                
#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 MsSql.Adapter.Generator as a Cake Addin
#addin nuget:?package=MsSql.Adapter.Generator&version=1.0.4

// Install MsSql.Adapter.Generator as a Cake Tool
#tool nuget:?package=MsSql.Adapter.Generator&version=1.0.4                

MsSql.Adapter.Generator

Build status NuGet License

A Source Generator package that generates methods for a class, including associated request & response classes, based on the result.json file created by dotnet-mssql-collector tool.

This source generator requires the .NET 6 SDK. You can target earlier frameworks like .NET Core 3.1 etc, but the SDK must be at least 6.0.100

Add the package (and required dependencies) to your application using

dotnet add package MsSql.Adapter.Generator
dotnet add package MsSql.Adapter.Standard.Types
dotnet add package MsSql.Adapter.Utils

This adds the <PackageReference> to your project. You can additionally mark the generator package as PrivateAsets="all" and ExcludeAssets="runtime".

Setting PrivateAssets="all" means any projects referencing this one won't get a reference to the MsSql.Adapter.Generator package. Setting ExcludeAssets="runtime" ensures the MsSql.Adapter.Generator.Attributes.dll_ file is not copied to your build output (it is not required at runtime).

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <LangVersion>Latest</LangVersion>
  </PropertyGroup>

  ~~~~
  <PackageReference Include="MsSql.Adapter.Generator" Version="1.0.0"
    PrivateAssets="all" ExcludeAssets="runtime" />
  

</Project>

Adding the package will automatically add a marker attribute, [MssqlAdapterAttribute], to your project.

To use the generator, add the [MssqlAdapterAttribute] attribute to a partial class. For example:

namespace Test
{
    [MsSqlAdapter]
    public partial class DalService
    {
    }
}

A class which holds the configuration needs to also exist in the same namespace (class name and properties names can be set in the attribute):

namespace Test
{
    [DataContract]
    public class DalServiceOptions
    {
        [DataMember(Order = 1)]
        public string ConnectionString { get; set; } = "";

        [DataMember(Order = 2)]
        public string? ConnectionUser { get; set; }

        [DataMember(Order = 3)]
        public string? ConnectionPassword { get; set; }
    }
}

This will generate an interface that can be used by the protobuf-net.Grpc. For example:

[ServiceContract(Name = "Test.ExampleDatabase.ExampleDatabaseService")]
public interface IDalService
{

    Task<FirstStoredProcedureResponse> FirstStoredProcedure(FirstStoredProcedureRequest req);
}

Additional files that can be used in javascript to add support for nullable values are generated in obj/GeneratedFiles/javascript/ folder.

For a boilerplate project which creates a gRPC service check MsSql.Adapter

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.2.1 914 3/21/2022
1.2.0 809 3/20/2022
1.1.0 802 3/19/2022
1.0.6 767 3/17/2022
1.0.5 801 3/14/2022
1.0.4 765 3/11/2022
1.0.3 780 3/11/2022
1.0.2 810 3/10/2022
1.0.1 932 3/10/2022
1.0.0 896 3/10/2022