Crusaders.Framework
2.0.3
dotnet add package Crusaders.Framework --version 2.0.3
NuGet\Install-Package Crusaders.Framework -Version 2.0.3
<PackageReference Include="Crusaders.Framework" Version="2.0.3" />
paket add Crusaders.Framework --version 2.0.3
#r "nuget: Crusaders.Framework, 2.0.3"
// Install Crusaders.Framework as a Cake Addin #addin nuget:?package=Crusaders.Framework&version=2.0.3 // Install Crusaders.Framework as a Cake Tool #tool nuget:?package=Crusaders.Framework&version=2.0.3
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, then upload to nuget using Crd admin account
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
- On dev machine, can run replace script after build to replace nuget locally for test integration.
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.
- Remarks: must run
dotnet ef
commands innet472
lib/project. EF need tool reference and setups (ie migration db connection). Thats why script cd to Migration then generate models in MetaData (netstandard2.0
)
- Remarks: must run
Read more about EF core guides in this repo here.
Migrations
- To regenerate Migration, delete relevant checkin from Migrations and Script
- Can remove mentioned directory for fresh migration history, but dont chenge
LocalDevFrameworkContext
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 | 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. |
-
.NETStandard 2.0
- AutoMapper (>= 10.1.1)
- Castle.Core (>= 5.1.1)
- Castle.Windsor (>= 6.0.0)
- FluentValidation (>= 11.6.0)
- Microsoft.AspNet.WebApi.Core (>= 5.2.9)
- Microsoft.Data.SqlClient (>= 5.2.1)
- 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.