コード例 #1
0
        public void Can_register_valid_license_from_EnvironmentVariable()
        {
            var licenseKeyText = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");

            Licensing.RegisterLicense(licenseKeyText);
            Assert.That(LicenseUtils.ActivatedLicenseFeatures(), Is.EqualTo(LicenseFeature.All));
        }
コード例 #2
0
        public void Add(Type serviceType, Type requestType, Type responseType)
        {
            this.ServiceTypes.Add(serviceType);
            this.RequestTypes.Add(requestType);

            var restrictTo = requestType.FirstAttribute <RestrictAttribute>()
                             ?? serviceType.FirstAttribute <RestrictAttribute>();

            var operation = new Operation {
                ServiceType  = serviceType,
                RequestType  = requestType,
                ResponseType = responseType,
                RestrictTo   = restrictTo,
                Actions      = GetImplementedActions(serviceType, requestType),
                Routes       = new List <RestPath>(),
            };

            this.OperationsMap[requestType] = operation;
            this.OperationNamesMap[operation.Name.ToLower()] = operation;
            //this.OperationNamesMap[requestType.Name.ToLower()] = operation;
            if (responseType != null)
            {
                this.ResponseTypes.Add(responseType);
                this.OperationsResponseMap[responseType] = operation;
            }


            LicenseUtils.AssertValidUsage(LicenseFeature.ServiceStack, QuotaType.Operations, OperationsMap.Count);
        }
コード例 #3
0
        /// <summary>
        /// The CRhCmn_ZooClient; ReturnLicense(), CheckOutLicense(),
        /// CheckInLicense(), ConvertLicense(), and GetLicenseType() methods call
        /// this method with the appropriate mode.
        /// </summary>
        /// <param name="mode">Calling function Id</param>
        /// <param name="id">License type Id</param>
        /// <returns></returns>
        static int UuidHelper(int mode, Guid id)
        {
            // Keep these values in synch with the values located at the top
            // of the rh_licensemanager.cpp file in the rhcommon_c project.
            const int modeReturnLicense   = 1;
            const int modeCheckOutLicense = 2;
            const int modeCheckInLicense  = 3;
            const int modeConvertLicense  = 4;
            const int modeGetLicenseType  = 5;

            switch (mode)
            {
            case modeReturnLicense:
                return(LicenseUtils.ReturnLicense(id) ? 1 : 0);

            case modeCheckOutLicense:
                return(LicenseUtils.CheckOutLicense(id) ? 1 : 0);

            case modeCheckInLicense:
                return(LicenseUtils.CheckInLicense(id) ? 1 : 0);

            case modeConvertLicense:
                return(LicenseUtils.ConvertLicense(id) ? 1 : 0);

            case modeGetLicenseType:
                return(LicenseUtils.GetLicenseType(id));
            }
            return(0);
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <param name="title"></param>
        /// <param name="capabilities"></param>
        /// <param name="textMask"></param>
        /// <param name="path"></param>
        /// <param name="validator"></param>
        /// <returns></returns>
        private static int CustomGetLicenseHelper(Guid id, [MarshalAs(UnmanagedType.LPWStr)] string title, uint capabilities, [MarshalAs(UnmanagedType.LPWStr)] string textMask, [MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr validator)
        {
            var helper = new ValidatorHelper(validator, id, title, path);
            var result = LicenseUtils.GetLicense(helper.ValidateProductKey, (int)capabilities, textMask);

            return(result ? 1 : 0);
        }
コード例 #5
0
        /// <summary>
        /// Command to set multuple binary safe arguments
        /// </summary>
        /// <param name="cmdWithBinaryArgs"></param>
        /// <returns></returns>
        protected bool SendCommand(params byte[][] cmdWithBinaryArgs)
        {
            if (!AssertConnectedSocket())
            {
                return(false);
            }

            Interlocked.Increment(ref __requestsPerHour);
            if (__requestsPerHour % 20 == 0)
            {
                LicenseUtils.AssertValidUsage(LicenseFeature.Redis, QuotaType.RequestsPerHour, __requestsPerHour);
            }

            if (log.IsDebugEnabled)
            {
                CmdLog(cmdWithBinaryArgs);
            }

            //Total command lines count
            WriteAllToSendBuffer(cmdWithBinaryArgs);

            //pipeline will handle flush, if pipelining is turned on
            if (Pipeline == null)
            {
                return(FlushSendBuffer());
            }

            return(true);
        }
コード例 #6
0
        public void Add(Type serviceType, Type requestType, Type responseType)
        {
            if (requestType.IsArray)
            {
                return; //Custom AutoBatched requests
            }
            this.ServiceTypes.Add(serviceType);
            this.RequestTypes.Add(requestType);

            var restrictTo = requestType.FirstAttribute <RestrictAttribute>()
                             ?? serviceType.FirstAttribute <RestrictAttribute>();

            var reqFilterAttrs = new[] { requestType, serviceType }
            .SelectMany(x => x.AllAttributes().OfType <IRequestFilterBase>()).ToList();
            var resFilterAttrs = (responseType != null ? new[] { responseType, serviceType } : new[] { serviceType })
                                 .SelectMany(x => x.AllAttributes().OfType <IResponseFilterBase>()).ToList();

            var authAttrs = reqFilterAttrs.OfType <AuthenticateAttribute>().ToList();
            var actions   = GetImplementedActions(serviceType, requestType);

            authAttrs.AddRange(actions.SelectMany(x => x.AllAttributes <AuthenticateAttribute>()));
            var tagAttrs = requestType.AllAttributes <TagAttribute>().ToList();

            var operation = new Operation
            {
                ServiceType              = serviceType,
                RequestType              = requestType,
                ResponseType             = responseType,
                RestrictTo               = restrictTo,
                Actions                  = actions.Map(x => x.Name.ToUpper()),
                Routes                   = new List <RestPath>(),
                RequestFilterAttributes  = reqFilterAttrs,
                ResponseFilterAttributes = resFilterAttrs,
                RequiresAuthentication   = authAttrs.Count > 0,
                RequiredRoles            = authAttrs.OfType <RequiredRoleAttribute>().SelectMany(x => x.RequiredRoles).ToList(),
                RequiresAnyRole          = authAttrs.OfType <RequiresAnyRoleAttribute>().SelectMany(x => x.RequiredRoles).ToList(),
                RequiredPermissions      = authAttrs.OfType <RequiredPermissionAttribute>().SelectMany(x => x.RequiredPermissions).ToList(),
                RequiresAnyPermission    = authAttrs.OfType <RequiresAnyPermissionAttribute>().SelectMany(x => x.RequiredPermissions).ToList(),
                Tags = tagAttrs,
            };

            this.OperationsMap[requestType] = operation;
            this.OperationNamesMap[operation.Name.ToLowerInvariant()] = operation;
            if (responseType != null)
            {
                this.ResponseTypes.Add(responseType);
                this.OperationsResponseMap[responseType] = operation;
            }

            //Only count non-core ServiceStack Services, i.e. defined outside of ServiceStack.dll or Swagger
            var nonCoreServicesCount = OperationsMap.Values
                                       .Count(x => x.ServiceType.Assembly != typeof(Service).Assembly &&
                                              x.ServiceType.FullName != "ServiceStack.Api.Swagger.SwaggerApiService" &&
                                              x.ServiceType.FullName != "ServiceStack.Api.Swagger.SwaggerResourcesService" &&
                                              x.ServiceType.FullName != "ServiceStack.Api.OpenApi.OpenApiService" &&
                                              x.ServiceType.Name != "__AutoQueryServices" &&
                                              x.ServiceType.Name != "__AutoQueryDataServices");

            LicenseUtils.AssertValidUsage(LicenseFeature.ServiceStack, QuotaType.Operations, nonCoreServicesCount);
        }
コード例 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="title"></param>
        /// <param name="id"></param>
        /// <param name="productBuildType"></param>
        /// <param name="path"></param>
        /// <param name="validator"></param>
        /// <returns></returns>
        private static int GetLicenseHelper([MarshalAs(UnmanagedType.LPWStr)] string title, Guid id, int productBuildType, [MarshalAs(UnmanagedType.LPWStr)] string path, IntPtr validator)
        {
            var helper = new ValidatorHelper(validator, id, title, path);
            var result = LicenseUtils.GetLicense(productBuildType, helper.ValidateProductKey);

            return(result ? 1 : 0);
        }
コード例 #8
0
        public void Add(Type serviceType, Type requestType, Type responseType)
        {
            this.ServiceTypes.Add(serviceType);
            this.RequestTypes.Add(requestType);

            var restrictTo = requestType.FirstAttribute <RestrictAttribute>()
                             ?? serviceType.FirstAttribute <RestrictAttribute>();

            var operation = new Operation {
                ServiceType  = serviceType,
                RequestType  = requestType,
                ResponseType = responseType,
                RestrictTo   = restrictTo,
                Actions      = GetImplementedActions(serviceType, requestType),
                Routes       = new List <RestPath>(),
            };

            this.OperationsMap[requestType] = operation;
            this.OperationNamesMap[operation.Name.ToLower()] = operation;
            //this.OperationNamesMap[requestType.Name.ToLower()] = operation;
            if (responseType != null)
            {
                this.ResponseTypes.Add(responseType);
                this.OperationsResponseMap[responseType] = operation;
            }

            //Only count non-core ServiceStack Services, i.e. defined outside of ServiceStack.dll or Swagger
            var nonCoreServicesCount = OperationsMap.Values
                                       .Count(x => x.ServiceType.Assembly != typeof(Service).Assembly &&
                                              x.ServiceType.FullName != "ServiceStack.Api.Swagger.SwaggerApiService" &&
                                              x.ServiceType.FullName != "ServiceStack.Api.Swagger.SwaggerResourcesService" &&
                                              x.ServiceType.Name != "__AutoQueryServices");

            LicenseUtils.AssertValidUsage(LicenseFeature.ServiceStack, QuotaType.Operations, nonCoreServicesCount);
        }
コード例 #9
0
        public void Throws_on_all_use_cases_with_exceeded_usage_and_no_license(LicenseUseCase licenseUseCase)
        {
            Assert.Throws <LicenseException>(() =>
                                             LicenseUtils.ApprovedUsage(LicenseFeature.None, licenseUseCase.Feature, licenseUseCase.AllowedLimit, licenseUseCase.AllowedLimit + 1, "Failed"));

            Assert.Throws <LicenseException>(() =>
                                             LicenseUtils.ApprovedUsage(LicenseFeature.None, licenseUseCase.Feature, licenseUseCase.AllowedLimit, int.MaxValue, "Failed"));
        }
コード例 #10
0
        public void Can_register_valid_licenses()
        {
            Licensing.RegisterLicense(TestBusiness2013Text);
            Assert.That(LicenseUtils.ActivatedLicenseFeatures(), Is.EqualTo(LicenseFeature.All));

            Licensing.RegisterLicense(TestIndie2013Text);
            Assert.That(LicenseUtils.ActivatedLicenseFeatures(), Is.EqualTo(LicenseFeature.All));
        }
コード例 #11
0
        public void Can_register_valid_license()
        {
#if !SL5
            Licensing.RegisterLicense(new ServiceStack.Configuration.AppSettings().GetString("servicestack:license"));
#else
            Licensing.RegisterLicense("1001-e1JlZjoxMDAxLE5hbWU6VGVzdCBCdXNpbmVzcyxUeXBlOkJ1c2luZXNzLEhhc2g6UHVNTVRPclhvT2ZIbjQ5MG5LZE1mUTd5RUMzQnBucTFEbTE3TDczVEF4QUNMT1FhNXJMOWkzVjFGL2ZkVTE3Q2pDNENqTkQyUktRWmhvUVBhYTBiekJGUUZ3ZE5aZHFDYm9hL3lydGlwUHI5K1JsaTBYbzNsUC85cjVJNHE5QVhldDN6QkE4aTlvdldrdTgyTk1relY2eis2dFFqTThYN2lmc0JveHgycFdjPSxFeHBpcnk6MjAxMy0wMS0wMX0=");
#endif
            Assert.That(LicenseUtils.ActivatedLicenseFeatures(), Is.EqualTo(LicenseFeature.All));
        }
コード例 #12
0
ファイル: SkimurContext.cs プロジェクト: snetts/skimur
 static SkimurContext()
 {
     LicenseUtils.RegisterLicense("2283-e1JlZjoyMjgzLE5hbWU6TWVkWENoYW5nZSxUeXBlOkluZGllLEhhc2g6TU" +
                                  "FyaTVzNGdQcEdlc0pqd1ZIUXVlL0lacDBZcCt3TkFLY0UyMTlJblBuMzRLNWFRb" +
                                  "HBYN204aGkrQXlRYzUvZnNVUlZzWXd4NjR0OFlXZEpjNUNYRTdnMjBLR0ZjQmhG" +
                                  "dTFNMHZVazJqcHdQb1RrbStDaHNPRm11Qm50TnZzOTkwcHAzRkxtTC9idThMekN" +
                                  "lTVRndFBORzBuREZ0WGJUdzdRMi80K09lQ2tZPSxFeHBpcnk6MjAxNi0wMi0xOX" +
                                  "0=");
 }
コード例 #13
0
        protected void Application_Start()
        {
            ServiceStackHelper.Help();
            LicenseUtils.ActivatedLicenseFeatures();

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
コード例 #14
0
        static void Main(string[] args)
        {
            "ActivatedLicenseFeatures: {0}".Print(LicenseUtils.ActivatedLicenseFeatures());

            Console.ReadLine();


            //new IntegrationTest(Dialect.Sqlite).Can_insert_update_and_select_AllTypes();

            Console.ReadLine();
        }
コード例 #15
0
ファイル: Startup.cs プロジェクト: dabide/ekklesia
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILifetimeScope lifetimeScope, IApplicationLifetime applicationLifetime)
        {
            LicenseUtils.RegisterLicense(Configuration["servicestack:license"]);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
                {
                    HotModuleReplacement = true,
                    ConfigFile           = "webpack.netcore.config.js",
                    HotModuleReplacementClientOptions = new Dictionary <string, string> {
                        { "reload", "true" }
                    }
                });
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseForwardedHeaders(new ForwardedHeadersOptions
                {
                    ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
                });
            }

            app.UseStaticFiles();

            app.UseSignalR(routes =>
            {
                routes.MapHub <SongHub>("song");
            });

            app.UseServiceStack(lifetimeScope.Resolve <AppHostBase>());

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                routes.MapSpaFallbackRoute(
                    name: "spa-fallback",
                    defaults: new { controller = "Home", action = "Index" });
            });

            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            lifetimeScope.Resolve <IWebcaster>().Start(8003, cancellationTokenSource.Token);

            applicationLifetime.ApplicationStopping.Register(() =>
            {
                cancellationTokenSource.Cancel();
            });
        }
コード例 #16
0
        public void RegisterHandler <T>(Func <IMessage <T>, object> processMessageFn, Action <IMessage <T>, Exception> processExceptionEx, int noOfThreads)
        {
            if (handlerMap.ContainsKey(typeof(T)))
            {
                throw new ArgumentException("Message handler has already been registered for type: " + typeof(T).Name);
            }

            handlerMap[typeof(T)]            = CreateMessageHandlerFactory(processMessageFn, processExceptionEx);
            handlerThreadCountMap[typeof(T)] = noOfThreads;

            LicenseUtils.AssertValidUsage(LicenseFeature.ServiceStack, QuotaType.Operations, handlerMap.Count);
        }
コード例 #17
0
ファイル: Startup.cs プロジェクト: soundwords/soundwords
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            Configuration = builder.Build();

            LicenseUtils.RegisterLicense(Configuration["servicestack:license"]);
        }
コード例 #18
0
 public IRedisTypedClient <T> As <T>()
 {
     try
     {
         var typedClient = new RedisTypedClient <T>(this);
         LicenseUtils.AssertValidUsage(LicenseFeature.Redis, QuotaType.Types, __uniqueTypes.Count);
         return(typedClient);
     }
     catch (TypeInitializationException ex)
     {
         throw ex.GetInnerMostException();
     }
 }
コード例 #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="productId"></param>
        /// <param name="ownerWStringPointer"></param>
        /// <param name="companyWStringPointer"></param>
        /// <returns></returns>
        static bool GetRegisteredOwnerInfoHelper(Guid productId, IntPtr ownerWStringPointer, IntPtr companyWStringPointer)
        {
            var owner   = string.Empty;
            var company = string.Empty;
            var rc      = LicenseUtils.GetRegisteredOwnerInfo(productId, ref owner, ref company);

            if (!rc)
            {
                return(false);
            }
            UnsafeNativeMethods.ON_wString_Set(ownerWStringPointer, owner);
            UnsafeNativeMethods.ON_wString_Set(companyWStringPointer, company);
            return(true);
        }
コード例 #20
0
ファイル: AppHost.cs プロジェクト: kleopatra999/CISetupWizard
        /// <summary>
        /// Default constructor.
        /// Base constructor requires a Name and assembly to locate web service classes.
        /// </summary>
        public AppHost()
            : base("CIWizard", typeof(MyServices).Assembly)
        {
            var customSettings = new FileInfo(@"~/appsettings.txt".MapHostAbsolutePath());

            AppSettings = customSettings.Exists
                ? (IAppSettings) new TextFileSettings(customSettings.FullName)
                : new AppSettings();

            if (AppSettings.Exists("ServiceStackLicense"))
            {
                LicenseUtils.RegisterLicense(AppSettings.GetString("ServiceStackLicense"));
            }
        }
コード例 #21
0
        static void Main(string[] args)
        {
            var licenseKey = Environment.GetEnvironmentVariable("SERVICESTACK_LICENSE");

            if (licenseKey.IsNullOrEmpty())
            {
                throw new ArgumentNullException("SERVICESTACK_LICENSE", "Add Environment variable for SERVICESTACK_LICENSE");
            }

            Licensing.RegisterLicense(licenseKey);
            "ActivatedLicenseFeatures: ".Print(LicenseUtils.ActivatedLicenseFeatures());

            Console.ReadLine();
        }
コード例 #22
0
ファイル: Startup.cs プロジェクト: dabide/ekklesia
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            LicenseUtils.RegisterLicense(Configuration["servicestack:license"]);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseServiceStack(new AppHost
            {
                AppSettings = new NetCoreAppSettings(Configuration)
            });
        }
コード例 #23
0
        public SqlConnectionProvider(IConnectionStringProvider connectionStringProvider)
        {
            _connectionStringProvider = connectionStringProvider;
            LicenseUtils.RegisterLicense("2283-e1JlZjoyMjgzLE5hbWU6TWVkWENoYW5nZSxUeXBlOkluZGllLEhhc2g6TU" +
                                         "FyaTVzNGdQcEdlc0pqd1ZIUXVlL0lacDBZcCt3TkFLY0UyMTlJblBuMzRLNWFRb" +
                                         "HBYN204aGkrQXlRYzUvZnNVUlZzWXd4NjR0OFlXZEpjNUNYRTdnMjBLR0ZjQmhG" +
                                         "dTFNMHZVazJqcHdQb1RrbStDaHNPRm11Qm50TnZzOTkwcHAzRkxtTC9idThMekN" +
                                         "lTVRndFBORzBuREZ0WGJUdzdRMi80K09lQ2tZPSxFeHBpcnk6MjAxNi0wMi0xOX" +
                                         "0=");

            OrmLiteConfig.DialectProvider = PostgreSqlDialect.Provider;
            //OrmLiteConfig.DialectProvider.NamingStrategy = new NamingStrategy();
            _factory = Npgsql.NpgsqlFactory.Instance;
        }
コード例 #24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="productTitle"></param>
        /// <param name="standAlone"></param>
        /// <param name="parent"></param>
        /// <param name="productId"></param>
        /// <param name="productBuildType"></param>
        /// <param name="textMask"></param>
        /// <param name="path"></param>
        /// <param name="validator"></param>
        /// <returns></returns>
        private static bool AskUserForLicenseHelper([MarshalAs(UnmanagedType.LPWStr)] string productTitle,
                                                    bool standAlone,
                                                    IntPtr parent,
                                                    Guid productId,
                                                    int productBuildType,
                                                    [MarshalAs(UnmanagedType.LPWStr)] string textMask,
                                                    [MarshalAs(UnmanagedType.LPWStr)] string path,
                                                    IntPtr validator)
        {
            var helper        = new ValidatorHelper(validator, productId, productTitle, path);
            var parentControl = System.Windows.Forms.ContainerControl.FromHandle(parent);
            var rc            = LicenseUtils.AskUserForLicense(productBuildType, standAlone, parentControl, textMask, helper.ValidateProductKey);

            return(rc);
        }
コード例 #25
0
        /// <summary>
        /// Command to set multuple binary safe arguments
        /// </summary>
        /// <param name="cmdWithBinaryArgs"></param>
        /// <returns></returns>
        protected void WriteCommandToSendBuffer(params byte[][] cmdWithBinaryArgs)
        {
            Interlocked.Increment(ref __requestsPerHour);
            if (__requestsPerHour % 20 == 0)
            {
                LicenseUtils.AssertValidUsage(LicenseFeature.Redis, QuotaType.RequestsPerHour, __requestsPerHour);
            }

            if (log.IsDebugEnabled && !RedisConfig.DisableVerboseLogging)
            {
                CmdLog(cmdWithBinaryArgs);
            }

            //Total command lines count
            WriteAllToSendBuffer(cmdWithBinaryArgs);
        }
コード例 #26
0
        public void Can_register_Text_License()
        {
            Licensing.RegisterLicense(TestText2013Text);

            var licensedFeatures = LicenseUtils.ActivatedLicenseFeatures();

            Assert.That(licensedFeatures, Is.EqualTo(LicenseFeature.Text));

            Assert.Throws <LicenseException>(() =>
                                             LicenseUtils.ApprovedUsage(LicenseFeature.None, LicenseFeature.Text, 1, 2, "Failed"));

            Assert.Throws <LicenseException>(() =>
                                             LicenseUtils.ApprovedUsage(LicenseFeature.OrmLite, LicenseFeature.Text, 1, 2, "Failed"));

            LicenseUtils.ApprovedUsage(LicenseFeature.Text, LicenseFeature.Text, 1, 2, "Failed");
        }
コード例 #27
0
        protected void Application_Start()
        {
            Licensing.RegisterLicenseFromFileIfExists(@"C:\src\appsettings.license.txt");

            if (!LicenseUtils.ActivatedLicenseFeatures().HasFlag(LicenseFeature.All))
            {
                throw new ConfigurationErrorsException("A valid license key is required for this demo");
            }

            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            new AppHost().Init();
        }
コード例 #28
0
        // Should only be called at StartUp
        public static DynamoMetadataType RegisterTable(Type type)
        {
            if (Types == null)
            {
                Types = new HashSet <DynamoMetadataType>();
            }

            Types.RemoveWhere(x => x.Type == type);

            var table = ToMetadataTable(type);

            Types.Add(table);

            LicenseUtils.AssertValidUsage(LicenseFeature.Aws, QuotaType.Tables, Types.Count);

            RegisterTypes(type.GetReferencedTypes());

            return(table);
        }
コード例 #29
0
        public Startup(IHostingEnvironment env)
        {
            IConfigurationBuilder builder = new ConfigurationBuilder()
                                            .SetBasePath(env.ContentRootPath)
                                            .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                                            .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);

            if (env.IsDevelopment())
            {
                // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
                //builder.AddUserSecrets();
            }

            builder.AddEnvironmentVariables();

            Configuration = builder.Build();

            LicenseUtils.RegisterLicense(Configuration["servicestack:license"]);
        }
コード例 #30
0
        public void LicenseActivation()
        {
            #region Arrange
            var licOrderId     = _irepo.GetLicenseOrderId();
            var logininfo      = _irepo.GetLicenseLoginInfo();
            var activationInfo = new ActivationInfoDTO
            {
                LicenseOrderId = licOrderId,
                MachineName    = LicenseUtils.GetMachineName(),
                MetaPath       = LicenseUtils.GetInstanceMetaPath(),
                Host           = LicenseUtils.GetHostName(),
            };
            #endregion

            //Act
            var data    = LicenseUtils.SerializeActivationInfo(activationInfo);
            var service = new LicensingService(logininfo);

            //Assert
            Assert.AreNotEqual(string.Empty, service.ActivateLicense(data));
        }