Piri.Extensions.DependencyInjection is a .NET library that provides extensions for integrating the Piri Object Mapper with the .NET Dependency Injection framework. This package simplifies the configuration and usage of the Piri Object Mapper in your .NET applications.
You can install the package via NuGet Package Manager or the .NET CLI.
Install-Package Piri.Extensions.DependencyInjection
dotnet add package Piri.Extensions.DependencyInjection
To use the Piri Object Mapper with Dependency Injection, follow these steps:
Configure Services:
In your Program.cs
or wherever you configure your services, add the Piri Object Mapper services.
using Microsoft.Extensions.DependencyInjection;
using Piri.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddPiriMapper(options => {
options.EnableDefaultMapping();
});
// Other service configurations
var app = builder.Build();
// Configure the HTTP request pipeline.
await app.RunAsync();
Inject and Use:
Inject the IMapper
interface into your classes and use it as needed.
using Piri.Core;
public class MyService {
private readonly IMapper _mapper;
public MyService(IMapper mapper)
{
_mapper = mapper;
}
public void MyMethod()
{
// Use the mapper
var destination = _mapper.Map<DestinationType>(source);
}
}
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for more details.
For any questions or feedback, please contact us at me@gturkmen.com.