Пример #1
0
 /// <summary>
 /// Add default Vue modules.
 /// </summary>
 /// <param name="options"></param>
 public static void AddDefaultVueModules(this ClientBuilderOptions options)
 {
     options.AddModule <VueWebApiModule>();
     options.AddModule <VueEmPagesModule>();
     options.AddModule <VueRoutesModule>();
     options.AddModule <VueTranslationsResourcesModule>();
     options.AddModule <VueStaticContentModule>();
     options.AddModule <VueConstantsModule>();
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScaffoldModulesProvider"/> class.
        /// </summary>
        /// <param name="hostEnvironment"></param>
        /// <param name="options"></param>
        /// <param name="serviceProvider"></param>
        public ScaffoldModulesProvider(
            IWebHostEnvironment hostEnvironment,
            IOptions <ClientBuilderOptions> options,
            IServiceProvider serviceProvider)
        {
            this.hostEnvironment      = hostEnvironment;
            this.clientBuilderOptions = options.Value;
            this.serviceProvider      = serviceProvider;

            this.LoadModules();
            this.SyncModules();
        }
Пример #3
0
        /// <summary>
        /// Registration and configuration of Client Builder.
        /// </summary>
        /// <param name="services"></param>
        /// <param name="optionsAction"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">Exception in case options are missing.</exception>
        public static IServiceCollection AddEmeraudeClientBuilder(this IServiceCollection services, Action <ClientBuilderOptions> optionsAction)
        {
            ClientBuilderOptions builderOptions = new ClientBuilderOptions();

            if (optionsAction == null)
            {
                throw new ArgumentException("Client builder options are not initialized correctly.");
            }

            optionsAction.Invoke(builderOptions);

            var applicationAssembly = Assembly.GetCallingAssembly().GetName().Name;
            var serviceProvider     = services.BuildServiceProvider();
            var configuration       = serviceProvider.GetService <IConfiguration>();

            services.Configure(optionsAction);

            services.AddScoped <IPageService, PageService>();
            services.AddScoped <IEndpointService, EndpointService>();

            services.AddScoped <IScaffoldModulesProvider, ScaffoldModulesProvider>();

            return(services);
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PageService"/> class.
 /// </summary>
 /// <param name="clientBuilderOptions"></param>
 /// <param name="logger"></param>
 public PageService(IOptions <ClientBuilderOptions> clientBuilderOptions, IEmLogger logger)
 {
     this.clientBuilderOptions = clientBuilderOptions.Value;
     this.logger = logger;
 }
Пример #5
0
 /// <summary>
 /// Load client builder options.
 /// </summary>
 /// <param name="options"></param>
 public void LoadOptions(ClientBuilderOptions options)
 {
     this.Options = options;
 }
Пример #6
0
 /// <summary>
 /// Add default build-in Xamarin Client Builder modules.
 /// </summary>
 /// <param name="options"></param>
 public static void AddDefaultXamarinModules(this ClientBuilderOptions options)
 {
     options.AddModule <XamarinTranslationsResourcesModule>();
     options.AddModule <XamarinDataTransferObjectsModule>();
     options.AddModule <XamarinServiceAgentsModule>();
 }