NoRe.Core 1.1.0

dotnet add package NoRe.Core --version 1.1.0
                    
NuGet\Install-Package NoRe.Core -Version 1.1.0
                    
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="NoRe.Core" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NoRe.Core" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="NoRe.Core" />
                    
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 NoRe.Core --version 1.1.0
                    
#r "nuget: NoRe.Core, 1.1.0"
                    
#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 NoRe.Core@1.1.0
                    
#: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=NoRe.Core&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=NoRe.Core&version=1.1.0
                    
Install as a Cake Tool

NoRe.Core

Usage

This project contains classes with a general purpose and is used in multiple NoRe projects. It can also provide you with useful functions:

  • Create XML from objects
  • Create objects from xml
  • Create XML configuration files
  • Pathmanager

Dependencies

  • .NET Framework 4.8

Classes

UML

uml diagramm

Description

Pathmanager
Usage

This static class contains paths to often used directories. These paths are used by other NoRe-Packages. Currently the following paths are available:

  • Startup Directory: Returns the directory where the .exe-file is stored/executed.
  • Configuration Directory: Returns the directory where all configuration files used by NoRe-Packages will be stored.

Example:

string path = System.IO.Path.Combine(Pathmanager.ConfigurationDirectory, "test.xml");

Attributes
  • public static string StartupDirectory: Returns the directory where the .exe-file is stored/executed.
  • public static string ConfigurationDirectory: Returns the directory where all configuration files used by NoRe-Packages will be stored. If the directory does not exist it is created.
XmlConverter
Usage

This static class allows to convert objects into xml strings and xml strings back into objects.

Example:

TestConfiguration test = XmlConverter.ConvertXmlToObject< TestConfiguration >(File.ReadAllText(Path)); string xml = XmlConverter.ConvertObjectToXml(test);

Functions
  • public static string ConvertObjectToXml(object): Converts an object into an readable xml string. Tabs are used to indent and new lines will be created. The string is in UTF-8 encoded.
  • public static T ConvertXmlToObject<T>(string): Converts a xml string into an object. The string needs to be UTF-8 encoded. Use T to specify the target object.
Configuration
Usage

This abstract class is the base class for all configurations used by NoRe-Packages. It allows to convert it self into an xml string and save that string in an external xml file. This xml file can also be read to restore the properties and attributes of a derived class.

Example:

   public class TestConfiguration : Configuration
    {
        public int Integer { get; set; }
        public string String { get; set; }
        public decimal Decimal { get; set; }
        public bool Boolean { get; set; }
        public DateTime DateTime { get; set; }
        public TestConfigurationObject TestConfigurationObject { get; set; }

        public TestConfiguration(string path) : base(path) { }
        public TestConfiguration() { }

        public override void Read()
        {
            TestConfiguration tc = Read<TestConfiguration>();
            Integer = tc.Integer;
            String = tc.String;
            Decimal = tc.Decimal;
            Boolean = tc.Boolean;
            DateTime = tc.DateTime;
            TestConfigurationObject = tc.TestConfigurationObject;
        }
    }

Note: An empty constructor is needed for (de)serialization.

Attributes
  • public string Path: This is the path where the configuration file will be written to or read from. This attribute needs to have a valid path before performing reading or writing. Assign the path manually or by using a constructor.
Functions
  • public Configuration(string): Create a derived configuration object and directly assign the configuration path
  • public Configuration(): An empty constructor is needed for (de)serialization
  • protected T Read< T >() where T: Configuration: This function reads an xml file into an object derived from the Configuration class and throws an exception if Path is not set. If the files does not exists it will be created.
  • public void Write(): Writes the derived configuration object into a xml file and throws an exception if Path is not set.
  • public abstract void Read(): This function needs to be overriden in order to assign the values of the Read< T >() function and allow for parameter less reading of the a xml file.
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NoRe.Core:

Package Downloads
NoRe.Database.SqLite

Offers a class for easy creation and acces of SqLiteDatabases

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 1,064 1/12/2020