LinearBase.Client
0.1.0-beta
dotnet add package LinearBase.Client --version 0.1.0-beta
NuGet\Install-Package LinearBase.Client -Version 0.1.0-beta
<PackageReference Include="LinearBase.Client" Version="0.1.0-beta" />
paket add LinearBase.Client --version 0.1.0-beta
#r "nuget: LinearBase.Client, 0.1.0-beta"
// Install LinearBase.Client as a Cake Addin #addin nuget:?package=LinearBase.Client&version=0.1.0-beta&prerelease // Install LinearBase.Client as a Cake Tool #tool nuget:?package=LinearBase.Client&version=0.1.0-beta&prerelease
LinearBase.Client
.NET-as-a-Database
- Relational (RDBMS) and Document database functionality miniaturized
, containerized
, and virtualized
and integrated into .NET.
LinearBase.Client
adds globally distributed
transactional
and relational
data processing
to .NET
.
The package provides inline Client
functionality capability over gRPC
.
Use in conjunction with the schema generation tools LinearBase.Transform.exe
and LinearBase.Model.exe
available to download free at LinearBase Downloads
Move data processing out of the database and into collaborative .NET App, Program, and micro-service virtual
hosts running on smart-devices, computers, servers, and the cloud, simultaneously.
LinearBase.Client
invisibly manages processing and distribution within and across participating hosts.
Supports Windows, Android, iOS, Mac, and Linux
deployments. Server
capability to 'listen' for Client requests not supported (use LinearBase.Server
package).
There are no data-contexts, connection strings, or Object Role Mappings (ORM) to manage; configurable profiles control everything.
Hierarchical Read()
// Starting at 1 return up to 5 Invoice.Order records
// Extent defines returned Product, Extent == 1 returns single instance otherwise Collection<T> of instances
// Specify root type to Read<T>(...)
var graph = hcd.Read<Invoice.Order>(
1, // Offset: one based record to start at
5, // Extent: number of records to return, maximum is 500
// include optional Where<TN>(...) clause for root type or any nested type including types in modelled 'cross-domain' associations
// hcd.Where<TN>(nameof(TN.TypeFieldName), Criteria.EqualTo("Some Value")),
// Include additional And<TN>(...) Or<TN>(...) filters
//.And<TN>(nameof(TN.TypeFieldName), Criteria.Between("Lower Value", "Upper Value"))
//.Or<TN>(nameof(TN.TypeFieldName), Criteria.GreaterThan("Some Value")),
cncellationToken);
// graph contains paging information and returned binary
_logger.LogInformation("Read returned {count} records. Page {page} of {of} from {from} matches", graph.Paging.Count, graph.Paging.Page, graph.Paging.Of, graph.Paging.From);
// Resolve graph binary using Product<T>() when Read.Extent == 1 otherwise Product<Collection<T>>()
var orders = graph.Product<Collection<Invoice.Order>>();
Transactional Write()
// Any new or updated instance or collection of new and/or updated instances
var instance = new Invoice.Order(...);
var statistics = hcd.Write(instance, cancellationToken);
// returned statistics contains transaction information, statistics.Continuum.Acidity reports outcome: Committed, Failed, RolledBack, and Cancelled
var outcome = statistics.Continuum.Acidity == Reference.Acidity.Committed ? "Write operation successful" : "Write operation failed";
_logger.LogInformation("Statistics returned Continuum.Acidity:{acidity} - {outcome}", statistics.Continuum.Acidity, outcome);
Realm
Critical to each installation is one or more auto-generated Realms
. A Realm describes the domain structure and schemas and defines the transaction boundary.
A Centralized
architecture will contain the Realm
and all domain Programs
hosted on a single Server
service. Clients
communicate with this service.
A Distributed
or Decentralized
architecture separates the Realm
, Server
services, and Clients
across individual collaborative hosts.
In this situation it is benficial to create a separate Primary Active Realm Service
(PARS) host.
The following suits Distributed and Decentralized architectures.
Configure LinearBase.Client
Configuration profiles control the entire system behaviour.
Each profile describes internal Client
data locations, distributed service endpoints (Server
services),
and individual program settings, e.g. concurrency, consistency, scope, etc.
LinearBase.Client
has no 'listen' capability and cannot accept external Client requests.
Configuration Profile modifications take effect on App or Program restart.
The LinearBase Transformation and Modelling programs auto-generate:
POCO's
(plain old CLR objects) representing domain models- Generic Host and Service extensions
- A demonstration console program
- Design-time and runtime profile initializers including docker-compose.yml
Design-time Client Host Setup
.NET MAUI Blazor Hybrid App MauiProgram.cs example...
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
});
builder.Services.AddMauiBlazorWebView();
// Reference auto-generated LinearBase Service extension method
builder.Services.AddLinearBaseService();
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
builder.Logging.AddDebug();
#endif
builder.Services.AddSingleton<YourCustomService>();
return builder.Build();
}
}
Auto-generated LinearBaseServiceExtension AddLinearBaseService(...) method reads and deploys the relevant configuration profile.
Create Hyper-Connected Data singleton and Publish one or more Profiles...
// Auto-generated code
public static class AddLinearBaseServiceExtension
{
public static IServiceCollection AddLinearBaseService(this IServiceCollection services)
{
//Lazy load, initialized on Hcd first use. Create Startup initializer
services.AddSingleton(provider =>
{
ILoggerFactory? loggerFactory = null;
ILogger? logger = null;
IHcd? hcd = null;
try
{
#region loggerFactory
loggerFactory = provider.GetService<ILoggerFactory>();
if (loggerFactory == null)
{
Console.WriteLine(@"Launch aborted, ILoggerFactory not a service, terminating launch process!");
return new Hcd(new LoggerFactory();
}
logger = loggerFactory.CreateLogger("AddLinearBaseService");
#endregion
#region Create & Publish
hcd = new Hcd(loggerFactory);
if(!hcd.Active)
{
logger.LogWarning("Unable to activate HCD service");
return hcd;
}
logger.LogInformation("Publish Hyper-Connected Data service...");
hcd.Publish(new Uri(@"http://<Your PARS IP Address>/PARSSERV/LOADTHIS"), <PARS Port>, CancellationToken.None);
// Optionally publish multiple Profiles
//hcd.Publish(...);
//hcd.Publish(...);
}
catch (Exception e)
{
logger?.LogError(e, "Publish Hyper-Connected Data service failed");
}
#endregion
return hcd ?? new Hcd(loggerFactory);
});
return services;
}
}
Links
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- Grpc.Net.Client (>= 2.59.0)
- Grpc.Net.Common (>= 2.59.0)
- Microsoft.Extensions.Logging.Abstractions (>= 7.0.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.1.0-beta | 66 | 5/22/2024 |
Initial 0.1.0 beta release