Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public RepositoryService(IDbService dbService, IMapperFactory mapperFactory, BlazorContext dbContext)
 {
     _mapper    = mapperFactory.GetMapper("DAL");
     _dbService = dbService;
     _dbContext = dbContext;
     _objectSet = GetObjectSet <T>();
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public Startup(IConfiguration configuration)
 {
     using (var client = new BlazorContext())
     {
         client.Database.EnsureCreated();
     }
     Configuration = configuration;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 7
0
 public CommandBusinessComponent(BlazorContext blazorContext)
 {
     _blazorContext = blazorContext;
 }
Ejemplo n.º 8
0
 public CourseController(BlazorContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public InvoiceRepository(BlazorContext context)
 {
     _context = context;
 }
 public EmployeeRepository(BlazorContext context)
 {
     _context = context;
 }
Ejemplo n.º 11
0
 public AlbumRepository(BlazorContext context)
 {
     _context = context;
 }
Ejemplo n.º 12
0
 public CustomerRepository(BlazorContext context)
 {
     _context = context;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 18
0
 public UnitOfWork(BlazorContext context) => _context = context;
 public StudentController(BlazorContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Ejemplo n.º 20
0
 public PlaylistTrackRepository(BlazorContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
Ejemplo n.º 21
0
 public MediaTypeRepository(BlazorContext context)
 {
     _context = context;
 }
Ejemplo n.º 22
0
 public VendaRepository(BlazorContext context)
 {
     _context = context;
 }
Ejemplo n.º 23
0
 public WeatherForecastRepository(BlazorContext context)
 {
     _context = context;
 }
Ejemplo n.º 24
0
 public InstructorController(BlazorContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Ejemplo n.º 25
0
 public GenreRepository(BlazorContext context)
 {
     _context = context;
 }
Ejemplo n.º 26
0
 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;
 }
Ejemplo n.º 28
0
 public DatabaseController(BlazorContext context)
 {
     _context = context;
     _context.Database.EnsureCreated();
 }