Skip to content

Commit

Permalink
Merge pull request #8 from NerosoftDev/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Codespilot authored Jul 9, 2023
2 parents d0b1ff3 + a52ff8a commit 41461f5
Show file tree
Hide file tree
Showing 115 changed files with 5,130 additions and 214 deletions.
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Interactive" Version="6.0.1" />
<PackageVersion Include="System.Diagnostics.PerformanceCounter" Version="7.0.0" />
<PackageVersion Include="System.Reactive" Version="5.0.0" />
<PackageVersion Include="System.Reactive" Version="6.0.0" />
<PackageVersion Include="System.Runtime.Caching" Version="7.0.0" />
<PackageVersion Include="System.Runtime.Loader" Version="4.3.0" />
<PackageVersion Include="System.Text.Json" Version="7.0.3" />
Expand Down Expand Up @@ -100,7 +100,7 @@
</ItemGroup>
<!-- Grpc -->
<ItemGroup>
<PackageVersion Include="Google.Protobuf" Version="3.23.3" />
<PackageVersion Include="Google.Protobuf" Version="3.23.4" />
<PackageVersion Include="Grpc" Version="2.46.6" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.55.0" />
<PackageVersion Include="Grpc.AspNetCore.Server" Version="2.55.0" />
Expand All @@ -113,8 +113,8 @@
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
105 changes: 57 additions & 48 deletions Euonia.sln

Large diffs are not rendered by default.

84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,87 @@
# Euonia
Euonia development framework and toolkit library for .NET application/service. Powered by Nerosoft.
Euonia is a development framework and toolkit library for developers to build .NET application/service. It aims to provide a comprehensive and user-friendly solution to empowers developers to build efficient, scalable and robust systems that can handle complex distributed workflows. Whether you are working on microservices, cloud-native applications, or any other distributed system, it offers a range of features, necessary tools and infrastructure to streamline your development process and enhance the overall performance of your project.

The word "eunoia" refers to a concept derived from the ancient Greek language. It is a term that signifies a state of goodwill, beautiful thinking, and a well-disposed mind. The word "eunoia" combines the prefix "eu," meaning "good" or "well," and "noos," meaning "mind" or "thinking." It encompasses the idea of having a positive mindset, open-heartedness, and a sincere attitude towards others. Eunoia can be seen as a virtue that promotes harmony, empathy, and generosity in interpersonal relationships. It is often associated with the ideal of achieving inner peace and fostering harmonious connections with others.

# Projects

## Diagram

```mermaid
graph TD
Euonia.Modularity --> Euonia.Core
Euonia.Hosting --> Euonia.Modularity
Euonia.Threading.ZooKeeper --> Euonia.Threading
Euonia.Threading.Redis --> Euonia.Threading
Euonia.Euonia.Threading.FileSystem --> Euonia.Threading
Euonia.Threading.Azure --> Euonia.Threading
Euonia.Threading --> Euonia.Core
Euonia.Mapping.Mapster --> Euonia.Mapping
Euonia.Mapping.Automapper --> Euonia.Mapping
Euonia.Repository.Mongo --> Euonia.Repository
Euonia.Repository.EfCore --> Euonia.Repository
Euonia.Repository --> Euonia.Domain
Euonia.Repository --> Euonia.Modularity
Euonia.Domain --> Euonia.Linq
Euonia.Domain --> Euonia.Core
Euonia.Application --> Euonia.Bus
Euonia.Application --> Euonia.Pipeline
Euonia.Application --> Euonia.Validation
Euonia.Bus --> Euonia.Domain
Euonia.Bus --> Euonia.Modularity
Euonia.Bus.InMemory --> Euonia.Bus
Euonia.Bus.RabbitMq --> Euonia.Bus
Euonia.Caching.Memory --> Euonia.Caching
Euonia.Caching.Runtime --> Euonia.Caching
Euonia.Caching.Redis --> Euonia.Caching
```

## Core module
- [Euonia.Core](/Source/Euonia.Core)
> Core library that providers base class, helpers and extension methods.
- [Euonia.Business](/Source/Euonia.Business)
> Object oriented & scalable business architecture library.
- [Euonia.Grpc](/Source/Euonia.Grpc)

> Providers tools and features to seamlessly integrate gRPC capabilities into projects.
- [Euonia.Hosting](/Source/Euonia.Hosting)
> A library that helps developer to build a host for .NET application/service quickly.
- [Euonia.Linq](/Source/Euonia.Linq)
> Toolkit library for LINQ.
- [Euonia.Modularity](/Source/Euonia.Modularity)
> To be added.
- [Euonia.Pipeline](/Source/Euonia.Pipeline)
> To be added.
- [Euonia.Validation](/Source/Euonia.Validation)
> Provides customizable validation capabilities for various data inputs.
## Caching module
- [Euonia.Caching](/Source/Euonia.Caching)
> Defines abstract classes & interfaces for caching service.
- [Euonia.Caching.Redis](/Source/Euonia.Caching.Redis)
> Implements ICachingService with Redis.
- [Euonia.Caching.Memory](/Source/Euonia.Caching.Memory)
> Implements ICachingService with *Microsoft.Extensions.Caching.Memory*.
- [Euonia.Caching.Runtime](/Source/Euonia.Caching.Runtime)
> Implements ICachingService with build-in *System.Runtime.Caching*.
## Domain Driven Design module
- [Euonia.Application](/Source/Euonia.Application)
> Defines abstract application service classes & interfaces.
- [Euonia.Domain](/Source/Euonia.Domain)
> Defines abstract domain service classes & interfaces.
- [Euonia.Repository](/Source/Euonia.Repository)
> Defines abstract repository classes & interfaces.
- [Euonia.Repository.EfCore](/Source/Euonia.Repository.EfCore)
> Implements IRepository with Entity Framework Core.
- [Euonia.Repository.Mongo](/Source/Euonia.Repository.Mongo)
> Implements IRepository with MongoDB.
# Donate
<img alt="" title="donate" width="512" src="https://github.com/realzhaorong/oss/blob/master/donate.png" />
Expand Down
1 change: 1 addition & 0 deletions Source/Euonia.Application/ApplicationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Nerosoft.Euonia.Application;

/// <inheritdoc />
public class ApplicationModule : ModuleContextBase
{
/// <inheritdoc />
Expand Down
3 changes: 1 addition & 2 deletions Source/Euonia.Application/Euonia.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

<ItemGroup>
<ProjectReference Include="..\Euonia.Bus\Euonia.Bus.csproj" />
<ProjectReference Include="..\Euonia.Core\Euonia.Core.csproj" />
<ProjectReference Include="..\Euonia.Domain\Euonia.Domain.csproj" />
<ProjectReference Include="..\Euonia.Modularity\Euonia.Modularity.csproj" />
<ProjectReference Include="..\Euonia.Pipeline\Euonia.Pipeline.csproj" />
<ProjectReference Include="..\Euonia.Validation\Euonia.Validation.csproj" />
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions Source/Euonia.Bus.InMemory/InMemoryMessageBusModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Nerosoft.Euonia.Bus.InMemory;

/// <summary>
/// Import this module to use the in-memory message bus.
/// </summary>
[DependsOn(typeof(MessageBusModule))]
public class InMemoryMessageBusModule : ModuleContextBase
{
Expand Down
13 changes: 13 additions & 0 deletions Source/Euonia.Bus.InMemory/MessageBus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ protected MessageBus(IMessageHandlerContext handlerContext, IServiceAccessor acc
ServiceAccessor = accessor;
}

/// <summary>
/// Gets the service accessor.
/// </summary>
protected IServiceAccessor ServiceAccessor { get; }

/// <summary>
Expand Down Expand Up @@ -96,11 +99,21 @@ protected virtual void OnMessageAcknowledged(MessageAcknowledgedEventArgs args)
MessageAcknowledged?.Invoke(this, args);
}

/// <summary>
/// Subscribes the specified message type.
/// </summary>
/// <param name="messageType"></param>
/// <param name="handlerType"></param>
public virtual void Subscribe(Type messageType, Type handlerType)
{
HandlerContext.Register(messageType, handlerType);
}

/// <summary>
/// Subscribes the specified message name.
/// </summary>
/// <param name="messageName"></param>
/// <param name="handlerType"></param>
public virtual void Subscribe(string messageName, Type handlerType)
{
HandlerContext.Register(messageName, handlerType);
Expand Down
13 changes: 13 additions & 0 deletions Source/Euonia.Bus.InMemory/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@

namespace Microsoft.Extensions.DependencyInjection;

/// <summary>
/// Message bus extensions for <see cref="IServiceCollection"/>.
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// Adds the in-memory command bus to the service collection.
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddInMemoryCommandBus(this IServiceCollection services)
{
return services.AddSingleton<ICommandBus>(provider =>
Expand All @@ -26,6 +34,11 @@ public static IServiceCollection AddInMemoryCommandBus(this IServiceCollection s
});
}

/// <summary>
/// Adds the in-memory event bus to the service collection.
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public static IServiceCollection AddInMemoryEventBus(this IServiceCollection services)
{
return services.AddSingleton<IEventBus>(provider =>
Expand Down
1 change: 0 additions & 1 deletion Source/Euonia.Bus/Euonia.Bus.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Euonia.Core\Euonia.Core.csproj" />
<ProjectReference Include="..\Euonia.Domain\Euonia.Domain.csproj" />
<ProjectReference Include="..\Euonia.Modularity\Euonia.Modularity.csproj" />
</ItemGroup>
Expand Down
18 changes: 18 additions & 0 deletions Source/Euonia.Business/Abstracts/IBusinessObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.ComponentModel;

namespace Nerosoft.Euonia.Business;

public interface IBusinessObject : IUseBusinessContext, INotifyPropertyChanged, INotifyPropertyChanging
{
FieldDataManager FieldManager { get; }

bool FieldExists(IPropertyInfo property);

object ReadProperty(IPropertyInfo propertyInfo);

TValue ReadProperty<TValue>(PropertyInfo<TValue> propertyInfo);

void LoadProperty(IPropertyInfo propertyInfo, object newValue);

void LoadProperty<TValue>(PropertyInfo<TValue> propertyInfo, TValue newValue);
}
5 changes: 5 additions & 0 deletions Source/Euonia.Business/Abstracts/ICommandObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Nerosoft.Euonia.Business;

public interface ICommandObject : IBusinessObject
{
}
26 changes: 26 additions & 0 deletions Source/Euonia.Business/Abstracts/IEditableObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace Nerosoft.Euonia.Business;

public interface IEditableObject
{
/// <summary>
/// Gets the current object state.
/// </summary>
ObjectEditState State { get; }

/// <summary>
/// Gets a value indicate if the object can save.
/// </summary>
bool IsSavable { get; }

bool IsInsert { get; }

bool IsUpdate { get; }

bool IsDelete { get; }

void MarkAsInsert();

void MarkAsUpdate();

void MarkAsDelete();
}
37 changes: 37 additions & 0 deletions Source/Euonia.Business/Abstracts/IHasRuleCheck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace Nerosoft.Euonia.Business;

public interface IHasRuleCheck
{
/// <summary>
/// Gets a value indicate that whether the object is currently valid or not.
/// </summary>
/// <returns><c>True</c> if the object is currently valid, otherwise <c>False</c>.</returns>
bool IsValid { get; }

/// <summary>
/// Indicates that a rule has completed.
/// </summary>
/// <param name="property"></param>
void RuleCheckComplete(IPropertyInfo property);

/// <summary>
/// Indicates that a rule has completed.
/// </summary>
/// <param name="property"></param>
void RuleCheckComplete(string property);

/// <summary>
/// Indicates that all rules have completed.
/// </summary>
void AllRulesComplete();

void SuspendRuleChecking();

void ResumeRuleChecking();

/// <summary>
/// Gets the broken rules for this object
/// </summary>
/// <returns></returns>
BrokenRuleCollection GetBrokenRules();
}
12 changes: 12 additions & 0 deletions Source/Euonia.Business/Abstracts/IOperableProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Nerosoft.Euonia.Business;

public interface IOperableProperty
{
object GetProperty(IPropertyInfo propertyInfo);

void SetProperty(IPropertyInfo propertyInfo, object newValue);
}
6 changes: 6 additions & 0 deletions Source/Euonia.Business/Abstracts/IReadOnlyObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Nerosoft.Euonia.Business;

public interface IReadOnlyObject : IBusinessObject
{

}
45 changes: 45 additions & 0 deletions Source/Euonia.Business/Abstracts/ISavable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
namespace Nerosoft.Euonia.Business;

public interface ISavable
{
/// <summary>
/// Event raised when an object has been saved.
/// </summary>
event EventHandler<SavedEventArgs> Saved;

/// <summary>
///
/// </summary>
/// <param name="newObject"></param>
void SaveComplete(object newObject);

/// <summary>
/// Saves the object to the database.
/// </summary>
/// <param name="forceUpdate">true to force the save to be an update.</param>
/// <param name="cancellationToken"></param>
/// <returns>A new object containing the saved values.</returns>
Task<object> SaveAsync(bool forceUpdate = false, CancellationToken cancellationToken = default);
}

public interface ISavable<T> where T : class
{
/// <summary>
/// Saves the object to the database.
/// </summary>
/// <param name="forceUpdate">true to force the save to be an update.</param>
/// <param name="cancellationToken"></param>
/// <returns>A new object containing the saved values.</returns>
Task<T> SaveAsync(bool forceUpdate = false, CancellationToken cancellationToken = default);

/// <summary>
///
/// </summary>
/// <param name="newObject"></param>
void SaveComplete(T newObject);

/// <summary>
/// Event raised when an object has been saved.
/// </summary>
event EventHandler<SavedEventArgs> Saved;
}
14 changes: 14 additions & 0 deletions Source/Euonia.Business/Abstracts/ITrackableObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Nerosoft.Euonia.Business;

public interface ITrackableObject
{
bool IsValid { get; }

bool IsChanged { get; }

bool IsDeleted { get; }

bool IsNew { get; }

bool IsSavable { get; }
}
Loading

0 comments on commit 41461f5

Please sign in to comment.