예제 #1
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            Clear();

            var url     = this.ServerUrl.Text;
            var version = this.AppVersion.Text;

            WriteLine($"URL: {url}");
            WriteLine($"Version: {version}");
            WriteLine();

            try
            {
                CustomProxy.ServerUrl = url;

                // the following code is for testing only!
                // this code sets the version tag dynamically, which
                // is normally not allowed - it should be set at app
                // startup using the fluent API only.
                // This code may not work in future versions of CSLA.
                var options = new CslaOptions(new Microsoft.Extensions.DependencyInjection.ServiceCollection());
                options.VersionRoutingTag(version);

                var portal = App.ApplicationContext.GetRequiredService <IDataPortal <TestClass> >();
                var obj    = await portal.FetchAsync();

                WriteLine($"Created from {obj.CreatedFrom}");
            }
            catch (Exception ex)
            {
                WriteLine($"EXCEPTION: {ex}");
            }
            WriteLine();
        }
예제 #2
0
        /// <summary>
        /// Configure CSLA .NET options for ASP.NET Core.
        /// </summary>
        /// <param name="services">ASP.NET services</param>
        /// <param name="setupAction">Setup action</param>
        /// <returns></returns>
        public static IServiceCollection ConfigureCsla(this IServiceCollection services, Action <CslaOptions, IServiceProvider> setupAction = null)
        {
            services.AddSingleton <CslaOptions>((sp) =>
            {
                var options = new CslaOptions();
                setupAction?.Invoke(options, sp);
                return(options);
            });

            return(services);
        }
예제 #3
0
파일: DataPortal.cs 프로젝트: gnilesh4/csla
 /// <summary>
 /// Creates an instance of the type.
 /// </summary>
 /// <param name="applicationContext"></param>
 /// <param name="dashboard"></param>
 /// <param name="options"></param>
 /// <param name="activator"></param>
 /// <param name="authorizer"></param>
 /// <param name="exceptionInspector"></param>
 /// <param name="factoryLoader"></param>
 /// <param name="interceptors"></param>
 /// <param name="exceptionHandler"></param>
 public DataPortal(
     ApplicationContext applicationContext,
     IDashboard dashboard,
     CslaOptions options,
     IAuthorizeDataPortal authorizer,
     InterceptorManager interceptors,
     IObjectFactoryLoader factoryLoader,
     IDataPortalActivator activator,
     IDataPortalExceptionInspector exceptionInspector,
     DataPortalExceptionHandler exceptionHandler)
 {
     ApplicationContext         = applicationContext;
     Dashboard                  = dashboard;
     Options                    = options.DataPortalServerOptions;
     Authorizer                 = authorizer;
     InterceptorManager         = interceptors;
     FactoryLoader              = factoryLoader;
     Activator                  = activator;
     ExceptionInspector         = exceptionInspector;
     DataPortalExceptionHandler = exceptionHandler;
 }
예제 #4
0
 public TestableDataPortal(
     ApplicationContext applicationContext,
     IDashboard dashboard,
     CslaOptions options,
     IAuthorizeDataPortal authorizer,
     InterceptorManager interceptors,
     IObjectFactoryLoader factoryLoader,
     IDataPortalActivator activator,
     IDataPortalExceptionInspector exceptionInspector,
     DataPortalExceptionHandler exceptionHandler
     ) : base(
         applicationContext,
         dashboard,
         options,
         authorizer,
         interceptors,
         factoryLoader,
         activator,
         exceptionInspector,
         exceptionHandler
         )
 {
     _authorizer = authorizer;
 }