Rocket.Libraries.DataModeling 1.1.0-beta03

This is a prerelease version of Rocket.Libraries.DataModeling.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Rocket.Libraries.DataModeling --version 1.1.0-beta03
                    
NuGet\Install-Package Rocket.Libraries.DataModeling -Version 1.1.0-beta03
                    
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="Rocket.Libraries.DataModeling" Version="1.1.0-beta03" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rocket.Libraries.DataModeling" Version="1.1.0-beta03" />
                    
Directory.Packages.props
<PackageReference Include="Rocket.Libraries.DataModeling" />
                    
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 Rocket.Libraries.DataModeling --version 1.1.0-beta03
                    
#r "nuget: Rocket.Libraries.DataModeling, 1.1.0-beta03"
                    
#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 Rocket.Libraries.DataModeling@1.1.0-beta03
                    
#: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=Rocket.Libraries.DataModeling&version=1.1.0-beta03&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rocket.Libraries.DataModeling&version=1.1.0-beta03&prerelease
                    
Install as a Cake Tool

Rocket.Libraries.DataModeling

Do a lot of data formatting for presentation. Don't pepper your code in random places with formatting statements. Instead, use this library to decorate your class properties with the desired final format.

Sounds vague? Read on, it is quite straightforward once you've seen the code examples.

Quick Start

1. Installation

Install the package from nuget

2. Configure your dotnet app

  1. Include in your startup.cs file.

using Rocket.Libraries.DataModeling.Configuration;

  1. Register services auth library in your ConfigureServices method.

public  void  ConfigureServices (IServiceCollection services)

{

//This registers all the various services of the Modeling Library for DI.
//We'll see these services as we move along.
services.SetupRocketDataModeling ();

//Register other services

}

3. Defining Properties To Be Formatted

If you have a class that contains properties that'll later on be output in a user-friendly format. Simply mark the properties with appropriate attributes.

namespace Example
{
		public class OrderLineItem
		{
			[FormatAsNumber (decimalPlacesCount: 2,formatSpecifier:'N',customCultureInfoName:"en-KE")]
			public  decimal Price { get; set; }

			[FormatAsDate(dateFormat:"dd/MM/yyyy",customCultureInfoName:"en-KE")]
			public  DateTime Dated { get; set; }
			
			public decimal Quantity { get; set; }
		}
}

4. Getting Formatted Values

Below is an example class that is using the library and the class above to get formatted value

	namespace Example
	{
		public class ExampleOfFormatting
		{
			private readonly Rocket.Libraries.DataModeling.Formatting autoFormatter;
			
			//Access the IEventQueue interface via DI.
			public ExampleOfFormatting(Rocket.Libraries.DataModeling.Formatting autoFormatter)
			{
				this.autoFormatter = autoFormatter;
			}

			public void DoFormatting()
			{
				var orderLineItem = new Example.OrderLineItem
				{
					Price = 5000,
					Dated = new DateTime(2022,02,08)
				};
				
				var formattedOrderLineItem = autoFormatter.GetSingleFormatted(orderLineItem);
			}

		}
	}

Above call returns a new object, which besides the original properties and values of the unformatted object, includes two new properties; Price_Formatted && Dated_Formatted which correspond to the decorated properties respectively.

You'll notice that there IS NOT a Quantity_Formatted property. This is because we did not place any formatting attributes on the Quantity property.

4.1 Points of Note on Formatted Object

  1. The newly created object that contains your formatted data, also contains all of the original properties, including their data.
  2. All new properties generated with formatted data are suffixed by _Formatted. Be careful not to name any of your own properties in a manner that would cause name collisions once your object is run through the formatter.
  3. The object created is a dynamic object, so its type is distinct from that of your original unformatted object.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.2.0-beta01 220 9/26/2022
1.1.0 490 5/6/2022
1.1.0-beta07 438 2/13/2022
1.1.0-beta06 210 2/13/2022
1.1.0-beta05 211 2/9/2022
1.1.0-beta04 222 2/8/2022
1.1.0-beta03 222 2/8/2022
1.1.0-beta02 232 2/8/2022
1.1.0-beta01 220 2/8/2022
1.0.0-beta23 254 9/6/2021
1.0.0-beta22 237 9/6/2021
1.0.0-beta21 227 9/6/2021
1.0.0-beta20 285 8/28/2021
1.0.0-beta19 260 8/28/2021
1.0.0-beta18 277 8/28/2021
1.0.0-beta17 272 8/28/2021
1.0.0-beta16 276 8/28/2021
1.0.0-beta14 272 8/28/2021
1.0.0-beta13 271 8/28/2021
1.0.0-beta12 243 8/27/2021
1.0.0-beta11 241 8/27/2021
1.0.0-beta10 255 8/27/2021
1.0.0-beta09 246 8/27/2021
1.0.0-beta08 249 8/27/2021
1.0.0-beta07 247 8/27/2021
1.0.0-beta06 249 8/27/2021
1.0.0-beta05 258 8/27/2021
1.0.0-beta04 255 8/27/2021
1.0.0-beta03 251 8/27/2021
1.0.0-beta02 241 8/27/2021
1.0.0-beta01 253 8/27/2021