Exemple #1
0
        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>();
 }
Exemple #3
0
        public static Component Instantiate(string cshtmlFileName, BlazorContext context)
        {
            var viewType = GetTypeForCompiledRazorFile(cshtmlFileName);
            var instance = (RazorComponent)Activator.CreateInstance(viewType);

            instance.Context = context;
            return(instance);
        }
Exemple #4
0
 public Startup(IConfiguration configuration)
 {
     using (var client = new BlazorContext())
     {
         client.Database.EnsureCreated();
     }
     Configuration = configuration;
 }
Exemple #5
0
 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));
 }
Exemple #6
0
        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));
        }
Exemple #7
0
 public CommandBusinessComponent(BlazorContext blazorContext)
 {
     _blazorContext = blazorContext;
 }
Exemple #8
0
 public CourseController(BlazorContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public InvoiceRepository(BlazorContext context)
 {
     _context = context;
 }
 public EmployeeRepository(BlazorContext context)
 {
     _context = context;
 }
Exemple #11
0
 public AlbumRepository(BlazorContext context)
 {
     _context = context;
 }
Exemple #12
0
 public CustomerRepository(BlazorContext context)
 {
     _context = context;
 }
Exemple #13
0
 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;
 }
Exemple #18
0
 public UnitOfWork(BlazorContext context) => _context = context;
 public StudentController(BlazorContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemple #20
0
 public PlaylistTrackRepository(BlazorContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
Exemple #21
0
 public MediaTypeRepository(BlazorContext context)
 {
     _context = context;
 }
Exemple #22
0
 public VendaRepository(BlazorContext context)
 {
     _context = context;
 }
Exemple #23
0
 public WeatherForecastRepository(BlazorContext context)
 {
     _context = context;
 }
Exemple #24
0
 public InstructorController(BlazorContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemple #25
0
 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;
 }
Exemple #28
0
 public DatabaseController(BlazorContext context)
 {
     _context = context;
     _context.Database.EnsureCreated();
 }