SI quisieramos usar el services.AddSingleton podria hacer esto:
En la clase StartUp.cs:
using Business;
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
services.AddSingleton<B_Product>();
}
Luego en el component:
@inject B_Product bProduct
@code {
ProductEntity oProduct = new ProductEntity();
private void Saveproduct()
{
bProduct.CreateProduct(oProduct);
}
}
Los aportes, preguntas y respuestas son vitales para aprender en comunidad. Regístrate o inicia sesión para participar.