Crusaders.Framework
1.0.2
This package only support net472. Later version support netstandard for netCoreApp and net472.
See the version list below for details.
dotnet add package Crusaders.Framework --version 1.0.2
NuGet\Install-Package Crusaders.Framework -Version 1.0.2
<PackageReference Include="Crusaders.Framework" Version="1.0.2" />
paket add Crusaders.Framework --version 1.0.2
#r "nuget: Crusaders.Framework, 1.0.2"
// Install Crusaders.Framework as a Cake Addin #addin nuget:?package=Crusaders.Framework&version=1.0.2 // Install Crusaders.Framework as a Cake Tool #tool nuget:?package=Crusaders.Framework&version=1.0.2
Crusaders Framework
.Net Framework 4.7.2
Welcome to Crusaders base repo. Here you should find all common features to extend in clients project, whether its Net2.0, AspNet web app or PC WPF apps
Build and Publish
Pipeline: src → scaffold Demo/Local Db → Build → Test → Pack → Publish
Publish:
- nuget - dll/Client api services
- Azure deploy - ASP
- ClickOnce - WinApp
Run publish script to generate nuget AFTER update
<Version>
in.csproj
TODO: CI pipeline is not setup, must run publish script locally on merged branch
Scaffold Db
- Run script to re-generate metadata after SQL alter.
- Check
Database
section for more info
Nuget publisher
- Nuget store: https://www.nuget.org/account/Organizations
Tools | EnvironmentVar PATH |
---|---|
msbuild |
%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin |
mstest , dotnet test |
%ProgramFiles%\Microsoft Visual Studio\2022\Community\Common7\IDE |
Database
EF Core Framework for .NetFramework (<
v4.0
)
You should download and setup localhost SQL server, then Run setup scripts in folder.
Read more about EF core operation use in this repo here.
Features
Logging
To use this feature, one must have FrameworkDbHash setup. This should point to Crusaders.Framework
catalog in the destination DB. AutoMapper supported.
Currently log:
- System message/errors (need code to trigger manually)
- Filter exception/error
- Incoming/Outgoing traffic
Service integration
using Crusaders.Framework.Integration;
Internal services
Install nuget package for Crusaders.API.`Client`.Services
private readonly ICrdApiClient<IService> _serviceClient;
public ImgSpoofingCommandHandler(ICrdApiClient<IService> serviceClient) { // Something }
// Can override Method name if not Get/Post
_serviceClient.Get((x, param) => x.Get(param), request);
_serviceClient.Post((x, param) => x.Post(param), request);
_serviceClient.Call((x, param) => x.MethodA(param), request, "MethodA");
External web service
public ImgSpoofingCommandHandler(IOutgoingCommandHandler pingCommandHandler) { // Something }
pingCommandHandler.Execute(new OutgoingPostCommand
{
Uri = $"{ImgSpoofingConfig.Hostname}/bg-ping",
//Timeout = 20,
});
Test framework
Unit test
Because Crusaders framewoek proj dont include client override implementation, please select unit test type that best match your current project
CrdUnitTest<IHandler>
: Use this to quickly test implementation of a service/handler. Be careful this only install default component and not intended to be use at Client projectCrdServiceUnitTest<IHandler, 'Client'.ApiConfiguration>
: Use this in client API project to quickly test implementation of a service/handler
Integration test (beta)
- This can be use to have test that call multiple DbContext/handler, and can perform mock remote service call (invoke the controller without hosting)
- Check ExceptionFilterBaseTest.cs for example
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 4.7.2
- AutoMapper (>= 10.1.1)
- Castle.Core (>= 5.1.1)
- Castle.Windsor (>= 6.0.0)
- FluentValidation (>= 11.6.0)
- Microsoft.AspNet.WebApi.Client (>= 5.2.9)
- Microsoft.AspNet.WebApi.Core (>= 5.2.9)
- Microsoft.AspNet.WebApi.WebHost (>= 5.2.9)
- Microsoft.Data.SqlClient (>= 5.2.1)
- Microsoft.Data.SqlClient.SNI (>= 5.2.0)
- Microsoft.EntityFrameworkCore (>= 3.1.32)
- Microsoft.EntityFrameworkCore.InMemory (>= 3.1.32)
- Microsoft.EntityFrameworkCore.Proxies (>= 3.1.32)
- Microsoft.EntityFrameworkCore.SqlServer (>= 3.1.32)
- Moq (>= 4.20.70)
- MSTest.TestAdapter (>= 2.2.7)
- MSTest.TestFramework (>= 2.2.7)
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Crusaders.Framework:
Package | Downloads |
---|---|
Crusaders.API.Vstar.Bg.Services
Vstar API that implements Crusaders framework. Public services only. |
GitHub repositories
This package is not used by any popular GitHub repositories.