Пример #1
0
        private void AssertLicenseParameters(RavenConfiguration config)
        {
            string maxCounters;

            if (ValidateLicense.CurrentLicense.Attributes.TryGetValue("numberOfCounters", out maxCounters))
            {
                if (string.Equals(maxCounters, "unlimited", StringComparison.OrdinalIgnoreCase) == false)
                {
                    var numberOfAllowedCounters = int.Parse(maxCounters);

                    int nextPageStart = 0;
                    var counters      =
                        systemDatabase.Documents.GetDocumentsWithIdStartingWith(ResourcePrefix, null, null, 0,
                                                                                numberOfAllowedCounters, CancellationToken.None, ref nextPageStart).ToList();
                    if (counters.Count >= numberOfAllowedCounters)
                    {
                        throw new InvalidOperationException(
                                  "You have reached the maximum number of counters that you can have according to your license: " +
                                  numberOfAllowedCounters + Environment.NewLine +
                                  "But we detect: " + counters.Count + " counter storages" + Environment.NewLine +
                                  "You can either upgrade your RavenDB license or delete a counter from the server");
                    }
                }
            }

            if (Authentication.IsLicensedForCounters == false)
            {
                throw new InvalidOperationException("Your license does not allow the use of the Counters");
            }

            Authentication.AssertLicensedBundles(config.Core.ActiveBundles);
        }
Пример #2
0
        private void AssertLicenseParameters(InMemoryRavenConfiguration config)
        {
            string maxDatabases;

            if (ValidateLicense.CurrentLicense.Attributes.TryGetValue("numberOfDatabases", out maxDatabases))
            {
                if (string.Equals(maxDatabases, "unlimited", StringComparison.OrdinalIgnoreCase) == false)
                {
                    var numberOfAllowedDbs = int.Parse(maxDatabases);

                    int nextPageStart = 0;
                    var databases     = systemDatabase.Documents.GetDocumentsWithIdStartingWith("Raven/Databases/", null, null, 0, numberOfAllowedDbs, CancellationToken.None, ref nextPageStart).ToList();
                    if (databases.Count > numberOfAllowedDbs)
                    {
                        throw new InvalidOperationException(
                                  "You have reached the maximum number of databases that you can have according to your license: " + numberOfAllowedDbs + Environment.NewLine +
                                  "But we detect: " + databases.Count + " databases" + Environment.NewLine +
                                  "You can either upgrade your RavenDB license or delete a database from the server");
                    }
                }
            }

            Authentication.AssertLicensedBundles(config.ActiveBundles);
        }