first commit

This commit is contained in:
2026-04-16 21:05:21 +04:30
commit 49591985ac
283 changed files with 12716 additions and 0 deletions
@@ -0,0 +1,16 @@
using Vizhvizh.BuildingBlocks.Application.Contract;
using Vizhvizh.BuildingBlocks.Domain.Contract;
namespace Vizhvizh.BuildingBlocks.Application.Configuration.Commnad;
public interface ICommandHandler<in TCommand>
where TCommand : ICommand
{
Task Handle(TCommand request, CancellationToken cancellationToken);
}
public interface ICommandHandler<in TCommand, TResult>
where TCommand : ICommand<TResult>
{
Task<TResult> Handle(TCommand request, CancellationToken cancellationToken);
}
@@ -0,0 +1,9 @@
using Vizhvizh.BuildingBlocks.Domain.Contract;
namespace Vizhvizh.BuildingBlocks.Application.Contract;
public interface INotificationHandler<T>
where T : INotification
{
Task Handle(T notification, CancellationToken cancellationToken);
}
@@ -0,0 +1,10 @@
using Vizhvizh.BuildingBlocks.Application.Contract;
using Vizhvizh.BuildingBlocks.Domain.Contract;
namespace Vizhvizh.BuildingBlocks.Application.Configuration.Query;
public interface IQueryHandler<in TQuery, TResult>
where TQuery : IQuery<TResult>
{
Task<TResult> Handle(TQuery request, CancellationToken cancellationToken);
}
@@ -0,0 +1,8 @@
namespace Vizhvizh.BuildingBlocks.Application.Contract;
public interface IExecutionContextAccessor
{
Guid UserId { get; }
bool IsAvailable { get; }
}
@@ -0,0 +1,12 @@
using System.Data;
namespace Vizhvizh.BuildingBlocks.Application.Data;
public interface ISqlConnectionFactory : IDisposable
{
IDbConnection GetOpenConnection();
IDbConnection CreateNewConnection();
string GetConnectionString();
}
@@ -0,0 +1,17 @@
using Vizhvizh.BuildingBlocks.Domain;
namespace Vizhvizh.BuildingBlocks.Application.Events;
public class DomainNotificationBase<T> : IDomainEventNotification<T>
where T : IDomainEvent
{
public T DomainEvent { get; }
public Guid Id { get; }
public DomainNotificationBase(T domainEvent, Guid id)
{
this.Id = id;
this.DomainEvent = domainEvent;
}
}
@@ -0,0 +1,14 @@
using Vizhvizh.BuildingBlocks.Application.Contract;
using Vizhvizh.BuildingBlocks.Domain.Contract;
namespace Vizhvizh.BuildingBlocks.Application.Events;
public interface IDomainEventNotification<out TEventType> : IDomainEventNotification
{
TEventType DomainEvent { get; }
}
public interface IDomainEventNotification : INotification
{
Guid Id { get; }
}
@@ -0,0 +1,8 @@
namespace Vizhvizh.BuildingBlocks.Application.Outbox;
public interface IOutbox
{
void Add(OutboxMessage message);
Task Save();
}
@@ -0,0 +1,26 @@
namespace Vizhvizh.BuildingBlocks.Application.Outbox;
public class OutboxMessage
{
public Guid Id { get; set; }
public DateTime OccurredOn { get; set; }
public string Type { get; set; }
public string Data { get; set; }
public DateTime? ProcessedDate { get; set; }
public OutboxMessage(Guid id, DateTime occurredOn, string type, string data)
{
this.Id = id;
this.OccurredOn = occurredOn;
this.Type = type;
this.Data = data;
}
private OutboxMessage()
{
}
}
@@ -0,0 +1,8 @@
namespace Vizhvizh.BuildingBlocks.Application.SelectBuilders;
// Interface برای پشتیبانی از دیتابیس‌های مختلف
public interface ISqlDialect
{
string BuildSelectQuery(List<string> columns, string table,
List<string> whereConditions, string? orderBy, int? top, (int pageNumber, int pageSize)? pagination);
}
@@ -0,0 +1,23 @@
using System.Linq.Expressions;
namespace Vizhvizh.BuildingBlocks.Application.SelectBuilders;
public interface ISqlSelectBuilder
{
ISqlSelectBuilder From(string tableName);
// حالت ساده: فقط یک Expression (وقتی نام ستون = نام پراپرتی DTO)
ISqlSelectBuilder Select<T>(params Expression<Func<T, object?>>[] selectors);
// حالت پیشرفته: جفت (Domain Prop, DTO Prop)
ISqlSelectBuilder Select<TDomain, TDto>(params (Expression<Func<TDomain, object?>> Domain, Expression<Func<TDto, object?>> Dto)[] mappings);
ISqlSelectBuilder Where<T>(Expression<Func<T, object?>> property, object? value);
ISqlSelectBuilder WhereLike<T>(Expression<Func<T, object?>> property, string pattern);
ISqlSelectBuilder Top(int count);
ISqlSelectBuilder OrderBy<T>(Expression<Func<T, object?>> property, bool ascending = true);
ISqlSelectBuilder Pagination(int pageNumber, int pageSize);
ISqlSelectBuilder Pagination<T>(int pageNumber, int pageSize, Expression<Func<T, object?>> property, bool ascending = true);
(string Sql, object Parameters) Build();
}
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\VichVich.BuildingBlocks.Domain\Vizhvizh.BuildingBlocks.Domain.csproj" />
</ItemGroup>
</Project>