Dapper.Sharding.CAP 1.0.7

dotnet add package Dapper.Sharding.CAP --version 1.0.7
NuGet\Install-Package Dapper.Sharding.CAP -Version 1.0.7
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="Dapper.Sharding.CAP" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dapper.Sharding.CAP --version 1.0.7
#r "nuget: Dapper.Sharding.CAP, 1.0.7"
#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 Dapper.Sharding.CAP as a Cake Addin
#addin nuget:?package=Dapper.Sharding.CAP&version=1.0.7

// Install Dapper.Sharding.CAP as a Cake Tool
#tool nuget:?package=Dapper.Sharding.CAP&version=1.0.7

https://gitee.com/znyet/dapper.sharding.cap

using Akka.Actor;
using Akka.Configuration;
using Dapper.Sharding.CAP;
using RestSharp;

var configIni = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
var config = ConfigurationFactory.ParseString(configIni);
var system = ActorSystem.Create("serverSys", config);

var serverCap = new ServerCap(system, "server");

var res = await serverCap.ExecuteAsync((token, actorPath) =>
{
    Console.WriteLine(token);
    Console.WriteLine(actorPath);
    //微服务1
    var client = new RestClient("http://localhost:9000");
    var req = new RestRequest("/home/index");
    req.AddQueryParameter("token", token);
    req.AddQueryParameter("actorPath", actorPath);
    var task1 = client.ExecuteAsync(req);

    //微服务2
    var client2 = new RestClient("http://localhost:9001");
    var req2 = new RestRequest("/home/index");
    req2.AddQueryParameter("token", token);
    req2.AddQueryParameter("actorPath", actorPath);
    var task2 = client2.ExecuteAsync(req2);
    return new Task[] { task1, task2 };
});
Console.WriteLine(res.Success);

Console.WriteLine("Hello, World!");
//web1
[Route("[controller]/[action]")]
public class HomeController : ControllerBase
{
	public IActionResult Index()
	{
		var token = Request.Query["token"];
		var actorPath = Request.Query["actorPath"];

		var tran = new DistributedTransactionCap(MyCap.Cap, token, actorPath, "t1");
		try
		{
			var data = JsonSerializer.Serialize(tran.TranMsg);
			DbContext.People.Insert(new PeopleTable { Name = data }, tran);
			tran.Commit();
		}
		catch (Exception ex)
		{
			tran.Rollback();
			Console.WriteLine(ex.Message);
		}
		return Content("ok");
	}
}
//web2
[Route("[controller]/[action]")]
public class HomeController : ControllerBase
{
	public IActionResult Index()
	{
		var token = Request.Query["token"];
		var actorPath = Request.Query["actorPath"];

		var tran = new DistributedTransactionCap(MyCap.Cap, token, actorPath, "t2");
		try
		{
			var data = JsonSerializer.Serialize(tran.TranMsg);
			DbContext.People.Insert(new PeopleTable { Name = data }, tran);
			tran.Commit();
		}
		catch (Exception ex)
		{
			tran.Rollback();
			Console.WriteLine(ex.Message);
		}
		return Content("ok");
	}
}
public class MyCap
{
	public static ClientCap Cap { get; }

	static MyCap()
	{
		var configIni = File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "Config.ini");
		var config = ConfigurationFactory.ParseString(configIni);
		var system = ActorSystem.Create("clientSys", config); //root
		Cap = new ClientCap(system, "c");
	}
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  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 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.0.7 452 5/29/2022