MPOSAirDataCleanUpSample 0.6.0
dotnet add package MPOSAirDataCleanUpSample --version 0.6.0
NuGet\Install-Package MPOSAirDataCleanUpSample -Version 0.6.0
<PackageReference Include="MPOSAirDataCleanUpSample" Version="0.6.0" />
<PackageVersion Include="MPOSAirDataCleanUpSample" Version="0.6.0" />
<PackageReference Include="MPOSAirDataCleanUpSample" />
paket add MPOSAirDataCleanUpSample --version 0.6.0
#r "nuget: MPOSAirDataCleanUpSample, 0.6.0"
#addin nuget:?package=MPOSAirDataCleanUpSample&version=0.6.0
#tool nuget:?package=MPOSAirDataCleanUpSample&version=0.6.0
Data clean up-project for MPOS Air.
To be used as a NuGet once development is finished for v1.0.0.
To add the functionality, add the following line to your configured services:
serviceCollection.AddDataCleanUpServices();
This call adds the CleanUpService functionality as well as the internal logging used. The logger output is being shown into the Console.
The following way of usage is enforced: USAGE:
- Add DataCleanings table to the database.
The nuget uses an internal entity called DataCleaning to keep track of the data that has been cleaned. The properties are as follow:
public class DataCleaning : Entity<int>
{
public DataCleaning() { }
public DataCleaning(CleanUpPeriod period, string entity, bool cleanUpStarted)
{
CleanUpPeriod = period;
Entity = entity;
CleanUpStarted = cleanUpStarted;
}
public CleanUpPeriod CleanUpPeriod { get; set; }
public DateTime? LastCleanUpTime { get; set; }
public string Entity { get; set; }
public bool IsCleaned { get; set; }
public bool CleanUpStarted { get; set; }
public bool CleanUpEnded { get; set; }
}
CAUTION: Make sure the table exists, otherwise, the nuget throws the error into the console and the cleaning will not take place.
- Setup the services in Startup.cs Inject your context into the clean up service and add entities as you please.
To add the functionality, add the following lines to your configured services:
cleanUpService.WithContext(context)
.ForEntity(typeof(Entity1), (x) =>
{
var convertedType = x as Entity1;
return convertedType.Amount > 900;
})
.WithStartTime(typeof(Entity1), "15:45:00")
.WithPeriod(CleanUpPeriod.Daily)
.InitializeCleanUp();
The ForEntity method requires a Type object that should derive from IEntity, found inside MposAirDataContracts nuget package, and a filter. You can chain as many entities as you like, however CleanUpPeriod will be set for ALL the entities defined, and you CANNOT add the same entity type more than once, otherwise an exception will be thrown for this at runtime (if this happens, check the console logs).
To add another entity, do it after the call for WithStartTime().
cleanUpService.WithContext(context)
.ForEntity(typeof(Entity1), (x) =>
{
var convertedType = x as Entity1;
return convertedType.Amount > 900;
})
.WithStartTime(typeof(Entity1), "15:45:00")
.ForEntity(typeof(Entity2), (x) =>
{
var convertedType = x as Entity2;
return convertedType.Amount > 900;
})
.WithStartTime(typeof(Entity2), "11:30:00")
.WithPeriod(CleanUpPeriod.Daily)
.InitializeCleanUp();
CAUTION: any and all exceptions are captured and shown into the console output of the application that uses the nuget.
At this point, the default values for the CleanUpPeriod object are:
- Daily
- Weekly - every Sunday
- Monthly - the 1st of every month
- Yearly - the last day of the year
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. net9.0 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.2.0)
- MposAirDataContracts (>= 2.0.0)
- Newtonsoft.Json (>= 12.0.3)
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 3.1.4)
- Serilog (>= 2.10.0)
- Serilog.Sinks.Console (>= 3.1.1)
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 |
---|