Neatoo.RemoteFactory 9.19.1

dotnet add package Neatoo.RemoteFactory --version 9.19.1
                    
NuGet\Install-Package Neatoo.RemoteFactory -Version 9.19.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="Neatoo.RemoteFactory" Version="9.19.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Neatoo.RemoteFactory" Version="9.19.1" />
                    
Directory.Packages.props
<PackageReference Include="Neatoo.RemoteFactory" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Neatoo.RemoteFactory --version 9.19.1
                    
#r "nuget: Neatoo.RemoteFactory, 9.19.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.
#:package Neatoo.RemoteFactory@9.19.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Neatoo.RemoteFactory&version=9.19.1
                    
Install as a Cake Addin
#tool nuget:?package=Neatoo.RemoteFactory&version=9.19.1
                    
Install as a Cake Tool

Remote Factory

Neatoo Remote Factory is a Data Mapper Factory for Domain Models powered by Roslyn Source Generators. It allows Domain Model objects to be 3-Tier client/server and authentication agnostic. Used with Neatoo you can create streamlined Rich Domain Models in .NET with authorization, business rules, data-binding and meta properties. All with a single controller and no DTOs*. It is Dependency Injection and Async/Await centric. Plus high performance thanks to the source generators.

Create streamlined Blazor and WPF applications with Neatoo!

Discord Nuget

Videos

Introduction

Example

Here is the factory interface generated by Neatoo Remote Factory using a Roslyn Source Generator for the PersonModel object class. It also generates the implementation.

    public interface IPersonModelFactory
    {
        IPersonModel? Create();
        Task<IPersonModel?> Fetch();
        Task<IPersonModel?> Save(IPersonModel target);
        Task<Authorized<IPersonModel>> TrySave(IPersonModel target);
        Authorized CanCreate();
        Authorized CanFetch();
        Authorized CanUpdate();
        Authorized CanInsert();
        Authorized CanDelete();
        Authorized CanSave();
    }

See the Person Demo example shown in the animation below. Given a domain model object and optional authorization object the factory is generated by Neatoo using that provides 3-Tier implementation and ties in the authorization.

Person Demo Gif

*No Dtos for the UI to Service/Application layer. Other patterns like repository may require DTOs.

Getting Started

To get started with Neatoo Remote Factory, follow these steps:

1. Install the Neatoo Remote Factory NuGet package in your client and server projects.

2. Register the necessary services in ASP.NET server application. Be sure to include your Domain Model library assembly.

builder.Services.AddNeatooRemoteFactory(NeatooFactory.Server, typeof(IPersonModel).Assembly);

3. Add a single controller to your ASP.NET server application

app.MapPost("/api/neatoo", (HttpContext httpContext, RemoteRequestDto request) =>
{
	var handleRemoteDelegateRequest = httpContext.RequestServices.GetRequiredService<HandleRemoteDelegateRequest>();
	return handleRemoteDelegateRequest(request);
});

4. In your client application, register the Neatoo Remote Factory services Note: Update the URL in the following code.


builder.Services.AddNeatooRemoteFactory(NeatooFactory.Remote, typeof(IPersonModel).Assembly);
builder.Services.AddKeyedScoped(Neatoo.RemoteFactory.RemoteFactoryServices.HttpClientKey, (sp, key) => {
		return new HttpClient { BaseAddress = new Uri("http://localhost:5183/") };
});

5. Create a domain model class and add the [Factory] attribute

[Factory]
public class PersonModel : IPersonModel
{
	public int Id { get; set; }
	public string Name { get; set; }
	public int Age { get; set; }
}

6. Add Factory Operation methods including Create, Fetch, Update, Insert and Delete

...
[Fetch]
public async Task<bool> Fetch([Service] IPersonContext personContext)
{
	var personEntity = await personContext.Persons.FirstOrDefaultAsync(x => x.Id == 1);
	if (personEntity == null)
	{
		return false;
	}
	this.MapFrom(personEntity);
	this.IsNew = false;
	return true;
}

7. Neato Remote Factory will use Roslyn to automatically generate a corresponding factory class

    public interface IPersonModelFactory
    {
        IPersonModel? Create();
        Task<IPersonModel?> Fetch();
        Task<IPersonModel?> Save(IPersonModel target);
    }

Example

For an example Blazor Standalone application see here. It shows all of the available operations: Create, Fetch, Insert, Update and Delete. It also shows how to add Authorization. For now, you do need to load the entire solution. You also need to deploy the EF database migrations.

Please reach out to me if you have any interest. More to come!

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Neatoo.RemoteFactory:

Package Downloads
Neatoo

A .NET Domain Models framework for Blazor and WPF powered by Roslyn source generators.

Neatoo.RemoteFactory.AspNetCore

Asp.Net Core Server Library for Neatoo.RemoteFactory

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.19.1 137 6/8/2025
9.19.0 129 6/7/2025
9.18.2 120 6/1/2025
9.18.1 106 6/1/2025
9.18.0 77 5/30/2025
9.17.3 173 5/28/2025
9.17.2 155 5/28/2025
9.16.2 241 5/15/2025
9.16.1 229 5/15/2025
9.16.0 231 5/15/2025
9.15.1 251 5/13/2025
9.15.0 188 4/28/2025
9.14.8 226 4/17/2025
9.14.7 198 4/17/2025
9.14.6 188 4/13/2025
9.14.5 105 4/12/2025
9.14.4 140 4/11/2025
9.14.3 180 4/8/2025
9.14.2 178 4/3/2025
9.14.1 163 3/31/2025
9.14.0 167 3/31/2025
9.13.2 147 3/27/2025
9.13.1 154 3/27/2025
9.12.0 474 3/26/2025
9.11.0 352 3/24/2025
9.10.0 279 3/23/2025
9.9.0 155 3/19/2025
9.8.0 162 3/19/2025
9.7.0 154 3/18/2025
9.6.0 154 3/17/2025
9.5.0-beta 79 3/15/2025
9.4.0-beta 104 3/14/2025

None yet