public static Component Instantiate(string cshtmlFileName, BlazorContext context) { var razorViewClassName = GetViewClassName(".", cshtmlFileName); var viewTypeName = $"Views.{razorViewClassName}"; Type viewType; if (Router.ViewAssemblies == null) { // In DNA, we can search across all loaded assemblies viewType = Type.GetType(viewTypeName); } else { // On the server, need to explicitly walk through the supplied list of assemblies viewType = Router.ViewAssemblies.Select(a => a.GetType(viewTypeName)).Where(t => t != null).FirstOrDefault(); } // To ensure that the constructor actually runs, use Instantiate from the IComponentRazorViewFactory interface. // For more info on why this is needed, see the comments about it in AddIComponentRazorViewFactoryImplementation // in the RazorRenderer project. var instance = ((IRazorComponentFactory)Activator.CreateInstance(viewType)).Instantiate(); instance.Context = context; return(instance); }
public RepositoryService(IDbService dbService, IMapperFactory mapperFactory, BlazorContext dbContext) { _mapper = mapperFactory.GetMapper("DAL"); _dbService = dbService; _dbContext = dbContext; _objectSet = GetObjectSet <T>(); }
public static Component Instantiate(string cshtmlFileName, BlazorContext context) { var viewType = GetTypeForCompiledRazorFile(cshtmlFileName); var instance = (RazorComponent)Activator.CreateInstance(viewType); instance.Context = context; return(instance); }
public Startup(IConfiguration configuration) { using (var client = new BlazorContext()) { client.Database.EnsureCreated(); } Configuration = configuration; }
internal static Component MountPageFromUrl(string url, BlazorContext context) { // By holding the _currentPageComponent in a static property, we ensure that it doesn't // get GCed while the user can still see and try to interact with it. // TODO: Instead of just using "MountAsPage" which destroys the entire previous element content, // somehow find the nearest common layout ancestor between the old and new page, and retain // the DOM/vdom up to and including that layout, and just insert the new sequence of child // layouts and the new page into it. _currentPageComponentPath = UrlToComponentPath(url); return(_currentPageComponent = RazorComponent .Instantiate(_currentPageComponentPath, context) .MountAsPage(_mountInElementSelector)); }
internal static Component OnNavigation(string descriptor) { var parsed = MiniJSON.Json.Deserialize(descriptor) as Dictionary <string, object>; var url = (string)parsed["url"]; var absoluteUrl = (string)parsed["absoluteUrl"]; if (_context == null) { _context = new BlazorContext(absoluteUrl); } else { _context.Url = absoluteUrl; } return(MountPageFromUrl(url, _context)); }
public CommandBusinessComponent(BlazorContext blazorContext) { _blazorContext = blazorContext; }
public CourseController(BlazorContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public InvoiceRepository(BlazorContext context) { _context = context; }
public EmployeeRepository(BlazorContext context) { _context = context; }
public AlbumRepository(BlazorContext context) { _context = context; }
public CustomerRepository(BlazorContext context) { _context = context; }
public Repository(BlazorContext context) => _context = context;
public TrackRepository(BlazorContext context) { _context = context; }
public NavigationRepository(BlazorContext blazorContext, SitecoreItemService sitecoreItemService, BlazorStateMachine blazorStateMachine) { _blazorContext = blazorContext; _sitecoreItemService = sitecoreItemService; _blazorStateMachine = blazorStateMachine; }
public PlaylistRepository(BlazorContext context) { _context = context; }
public ArtistRepository(BlazorContext context) { _context = context; }
public UnitOfWork(BlazorContext context) => _context = context;
public StudentController(BlazorContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public PlaylistTrackRepository(BlazorContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public MediaTypeRepository(BlazorContext context) { _context = context; }
public VendaRepository(BlazorContext context) { _context = context; }
public WeatherForecastRepository(BlazorContext context) { _context = context; }
public InstructorController(BlazorContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public GenreRepository(BlazorContext context) { _context = context; }
public AccountRepository(IDbService dbService, IMapperFactory mapperFactory, UserManager <User> userManager, IJwtFactory jwtFactory, IOptions <JwtIssuerOptions> jwtOptions, BlazorContext dbContext) : base(dbService, mapperFactory, dbContext) { _userManager = userManager; _jwtFactory = jwtFactory; _jwtOptions = jwtOptions.Value; }
public NavigationRepository(BlazorContext blazorContext, SitecoreItemService sitecoreItemService) { _blazorContext = blazorContext; _sitecoreItemService = sitecoreItemService; }
public DatabaseController(BlazorContext context) { _context = context; _context.Database.EnsureCreated(); }