Skip to content

Commonality is a .NET Standard (1.3) library of platform-independent, domain-independent classes which are useful to accomplish fundamental tasks in .NET applications.

License

Notifications You must be signed in to change notification settings

jcoliz/Commonality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commonality

Commonality is a .NET Standard (1.3) library of platform-independent, domain-independent classes which are useful to accomplish fundamental tasks in .NET applications.

Service Locator

  • ServiceLocator. Implements the service locator pattern. Some classes in this library use this service locator to find dependant services. By convention, all classes in this library tolerate missing services without any error or exception.

Clock Handlers

Provides an abstract way of getting/setting the time, and an implementation for using the system clock.

  • IClock. Defines a platform-dependent service to access the time
  • DotNetClock. Provides a standard dotnet 'DateTime.Now' in the IClock interface, with the ability to set the time for internal use only. (Doesn't affect the system clock)

Logging

Provides an abstract way of logging instrumentation events, and a filesystem-based implementation for writing them to disk.

  • ILogger. Defines a platform-dependent service to log events and errors. Typically this is backed by a server-side instrumentation service, but it can also be used to capture all events locally.
  • FileSystemLogger. This is a simple logger which just logs to the local file system. No cloud analytics here.

Common Patterns for XAML ViewModel Binding

When writing viewmodels which bind to XAML, a few common patterns recur, which these classes can help with.

Value Converters

Classes to help with common situations in XAML where values need to be converted, but does so in a platform-independent way.

  • IBaseValueConverter. Defines a platform-independent way to implement view converters. In order to actually use a platform-independent view converter, you'll usually still need to convert to a platform-specific valueconverter. Still, you can convert any valueconveter based on this interface to something platform-specific with a single generic.
  • TimeSpanFormatConverter. Value converter to apply a custom timespan format to convert a timespan to a string
  • DateTimeFormatConverter. Value converter to apply a custom datetime format to convert a datetime to a string
  • DefaultConverter. General purpose "bool to {something}" converter. Instead of just converting from bool, it converts from ANYTHING, by comparing it with the default value for that type.

Standard Interfaces

Interfaces which can abstract away commonly-needed services.

  • ISettings. This interface can abstract away the platform-specific way to get at key/value pair settings.
  • IApplicationInfo. This interface can be used by shared/portable code logic modules to get at information about the app context in which it's running.

About

Commonality is a .NET Standard (1.3) library of platform-independent, domain-independent classes which are useful to accomplish fundamental tasks in .NET applications.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages