[성현모] DeviceManager, Factory 리팩토링, DIO, Scanner 추가
This commit is contained in:
24
eCIAv2.Library/Devices/DeviceFactory.cs
Normal file
24
eCIAv2.Library/Devices/DeviceFactory.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace eCIAv2.Library.Devices
|
||||
{
|
||||
public class DeviceFactory
|
||||
{
|
||||
private readonly IServiceProvider _provider;
|
||||
|
||||
public DeviceFactory(IServiceProvider provider)
|
||||
{
|
||||
_provider = provider;
|
||||
}
|
||||
|
||||
public T Create<T>()
|
||||
{
|
||||
return _provider.GetRequiredService<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user