去除 ServiceStack.Redis 的6000次限制。

方法一、

下载

https://github.com/ServiceStack/ServiceStack.Text

修改LicenseUtils.cs文件中的AssertValidUsage

var licensedFeatures = ActivatedLicenseFeatures();

后面添加   return;

方法二、调用下面的代码之后就没有了限制

var licenseKey = new LicenseKey()
{
Ref = "pedoc",
Expiry = DateTime.Now.AddDays(365 * 5),
Hash = string.Empty,
Name = "pedoc",
Type = LicenseType.Enterprise
};
var field = typeof(LicenseUtils).GetField("__activatedLicense",
BindingFlags.Static | BindingFlags.NonPublic);
var keyType = field.FieldType;
var constructorInfos = keyType.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic);
var constructorInfo = constructorInfos[0];
var key = constructorInfo.Invoke(new object[] { licenseKey });
field.SetValue(null, key);
var licenceAll = LicenseUtils.HasLicensedFeature(LicenseFeature.All);
Debug.Assert(licenceAll);

猜你喜欢

转载自www.cnblogs.com/onecool/p/10132488.html