Skip to content

Instantly share code, notes, and snippets.

View piyoEsq's full-sized avatar

piyosi piyoEsq

  • Japan, Kanagawa
View GitHub Profile
@piyoEsq
piyoEsq / ElementReferencePage.razor
Last active February 20, 2020 00:59
Blazor WebAssemblyでElementReferenceが設定されるタイミングの検証
@page "/ElmRef"
<ShowChildElementReferenceIdComponent DummyValue="test"/>
<div @ref="divElementReferenceOfParent"></div>
<ShowParentElementReferenceIdComponent DummyValue="test" ParentElementReference="divElementReferenceOfParent"/>
@code {
private ElementReference divElementReferenceOfParent;
}
@piyoEsq
piyoEsq / AutoRegisterServiceToGenericHostDIContainer.cs
Created December 26, 2019 13:33
Auto register services to DI Container of GenericHost that use Microsoft.Extensions.DependencyInjection.
using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Sample.GenericHost
{
@piyoEsq
piyoEsq / ConfigureServicesRegisterSample.cs
Created December 22, 2019 01:20
Register ConfigureServices by scanning Assembly
public interface IInstall
{
void install(IServiceCollection services, IConfiguration configuration);
}
public class DbInstaller : IInstall
{
public void install(IServiceCollection services, IConfiguration configuration)
{
services.AddDbContext<DbContext>(opt => opt.UseSqlServer(configuration.GetConnectionString("DefaultConnection")));