![]() |
VOOZH | about |
dotnet add package Kephas.Abstractions --version 11.1.0
NuGet\Install-Package Kephas.Abstractions -Version 11.1.0
<PackageReference Include="Kephas.Abstractions" Version="11.1.0" />
<PackageVersion Include="Kephas.Abstractions" Version="11.1.0" />Directory.Packages.props
<PackageReference Include="Kephas.Abstractions" />Project file
paket add Kephas.Abstractions --version 11.1.0
#r "nuget: Kephas.Abstractions, 11.1.0"
#:package Kephas.Abstractions@11.1.0
#addin nuget:?package=Kephas.Abstractions&version=11.1.0Install as a Cake Addin
#tool nuget:?package=Kephas.Abstractions&version=11.1.0Install as a Cake Tool
This package is the foundation for all the other Kephas packages. It consists of multiple areas, which are described below.
Check the following packages for more information:
The logging abstractions provide implementation agnostic logging contracts. The loggers are available through Injection.
Packages providing specific logging implementations:
ILogManager singleton serviceThe log manager is a service registered in the ambient services. It provides the following method:
GetLogger(loggerName): ILogger: retrieves the logger with the provided name.GetLogger<T>(): ILogger (extension): retrieves the logger having the same name with the generic type's argument full name.By default, a NullLoggerManager will be used, if not overwritten with a more specific implementation (NLog, Serilog, Log4Net, or other).
A logger implements the ILogger contract, is identified by its name and is created by the log manager. For injection purposes, a generic ILogger<TService> service contract is provided to be imported by injectable services.
It provides a single method which logs the provided arguments at the indicated level:
Log(level: LogLevel, exception?: Exception, messageFormat: string, params args: object[]).Note to implementors: the exception may be
null, so be cautious and handle this case too. For example, theLoggerExtensions.Logextension method passes anullexception.
For convenience, however, extension methods are provided to log fatal errors, errors, warnings, information, debug and trace data.
There are two kinds of components which can consume logging services:
To log anything, each consumer must firstly receive the logger it requires to consume its services by using specific means. Recommendations:
ILogger interface. Reason: someday the circumstances may dictate to change the logging framework, and it will be a lot easier to change only the logger implementation compared to all logger specific code.Injectable services should just import the logger through the constructor, with the type ILogger<ServiceType>, where ServiceType is the type of the service.
Alternatively, the service can extend Loggable by providing it, optionally, an ILogManager.
[SingletonAppServiceContract]
public interface IModelContainer
{
//...
}
public class ModelContainer : IModelContainer
{
public ModelContainer(ILogger<ModelContainer> logger)
{
this.Logger = logger;
}
protected ILogger<ModelContainer> Logger { get; }
}
// - or - inherit from Loggable, if there are no base class restrictions
public class ModelContainer : Loggable, IModelContainer
{
public ModelContainer(ILogManager? logManager = null)
: base(logManager)
{
}
}
These classes should use the globally defined ILogManager through LoggingHelper.DefaultLogManager.
public static class ReflectionHelper
{
/// <summary>
/// Logger instance.
/// </summary>
private static readonly ILogger Logger = LoggingHelper.DefaultLogManager.GetLogger<ReflectionHelper>();
//...
}
Caution: Make sure that at the time of calling
DefaultLogManagerit is properly initialized with the desired log manager, otherwise a logger logging nothing will be provided.
Sometimes it is very useful for objects to provide dynamic behavior, so that, on the fly, new properties may be added to them without recompilation, just like in the dynamic languages like JavaScript or Python. Their properties ca be accessed:
IDynamic interfaceObjects supporting settings or getting values by the mean of a string key implement the IDynamic interface.
It provides one single indexer:
this[key: string]: object. By this mean, the object may be used like a dictionary.ExpandoA ready-to-use expando class is Expando. Upon initialization, a flag controls how the internal dictionary is used: thread safe or not. Depending on it, the inner dictionary is set to a ConcurrentDictionary or Dictionary.
dynamic expando = new Expando();
expando.Property = "value";
Assert.AreEqual("value", expando.Property);
var dictionary = new Dictionary<string, object>();
dynamic expando = new Expando(dictionary);
expando.Property = "value";
Assert.AreEqual("value", dictionary["Property"]);
public class Person : Expando
{
public int Age { get; set; }
}
//...
var person = new Person();
person.Age = 30; // the age is set through the class API
dynamic dynPerson = person;
dynPerson.Age = 23; // the age is set through the dynamic features
Assert.AreEqual(23, person.Age);
person["Age"] = 40;
Assert.AreEqual(40, person.Age);
dynPerson.IsOld = true;
Assert.IsTrue(person["IsOld"]);
public class Contact
{
public string Name { get; set; }
}
//...
var contact = new Contact();
dynamic dynContact = new Expando(contact);
dynContact.Name = "John";
Assert.AreEqual("John", contact.Name);
Expandos can be successfully used where a dynamic context is useful. Examples:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Kephas.Abstractions:
| Package | Downloads |
|---|---|
|
Kephas.Core
Aggregates the most used Kephas infrastructure to provide a . Typically used areas and classes/interfaces/services: - AmbientServices - Data: IIdGenerator, DefaultIdGenerator. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems. |
|
|
Kephas.Data
Provides abstractions for managing data: retrieval, persistence, query. Typically used areas and classes/interfaces/services: - IDataSpace, IDataContext. - Capabilities: IEntityEntry, EntityEntry. - Conversion: IDataConversionService, IDataConverter, DataConverterBase. - DataSources: IDataSourceService, IDataSourceProvider. - Behaviors: IDataBehavior, DataBehaviorBase, QueryBehaviorBase. - Analysis: IRefPropertiesProvider. - Setup: IDataSetupManager, IDataInstaller. - Validation: IOnValidateBehavior. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems. |
|
|
Kephas.Messaging
Provides services for messaging, a.k.a. request/response service layer. Typically used areas and classes/interfaces/services: - IMessageProcessor, IMessage, MessageHandlerBase. - Distributed: IMessageBroker, IBrokeredMessage, MessageRouterBase. - Behaviors: IMessagingBehavior, MessagingBehaviorBase. - Events: IEvent. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems. |
|
|
Kephas.Model
Provides an abstract multi-dimensional modeling infrastructure, containing extensible model elements like dimensions, classifiers, and value types. Typically used areas and classes/interfaces/services: - IModelSpace, IClassifier, IAnnotation, IProperty, IMethod, IParameter. - AttributedModel: AbstractAttribute, AspectAttribute, AspectForAttribute, MixinAttribute, ValueTypeAttribute. Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems. |
|
|
Kephas.Logging.NLog
Provides the NLog logging services implementation. Typically used areas and classes/interfaces/services: - IAmbientServices.WithNLogManager(). Kephas Framework ("stone" in aramaic) aims to deliver a solid infrastructure for applications and application ecosystems. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.1.0 | 33,350 | 4/13/2022 |
| 11.1.0-dev.4 | 361 | 4/6/2022 |
| 11.1.0-dev.3 | 311 | 3/30/2022 |
| 11.1.0-dev.2 | 334 | 3/23/2022 |
| 11.1.0-dev.1 | 313 | 3/23/2022 |
| 11.0.0 | 27,664 | 3/11/2022 |
| 11.0.0-dev.7 | 357 | 3/7/2022 |
| 11.0.0-dev.6 | 319 | 2/28/2022 |
| 11.0.0-dev.5 | 322 | 2/26/2022 |
| 11.0.0-dev.4 | 318 | 2/24/2022 |
| 11.0.0-dev.3 | 327 | 2/23/2022 |
| 11.0.0-dev.2 | 356 | 2/18/2022 |
| 11.0.0-dev.1 | 307 | 2/7/2022 |
| 10.3.0 | 29,126 | 1/18/2022 |
| 10.2.0 | 15,374 | 12/3/2021 |
| 10.1.0 | 21,652 | 11/23/2021 |
| 10.1.0-dev.7 | 386 | 11/17/2021 |
| 10.1.0-dev.6 | 356 | 11/16/2021 |
| 10.1.0-dev.5 | 380 | 11/10/2021 |
| 10.1.0-dev.4 | 402 | 11/8/2021 |
Please check https://github.com/kephas-software/kephas/releases for the change log.
Also check the documentation and the samples from https://github.com/kephas-software/kephas/wiki and https://github.com/kephas-software/kephas/tree/master/Samples.