我们在项目中使用服务总线队列.当管理员选择清除队列时,我们需要一种功能来从队列中删除所有消息.我在网上搜索但找不到任何在QueueClient课堂上做这个的功能.
我是否必须逐个弹出所有消息,然后将它们标记为完成以清除队列或者有更好的方法吗?
QueueClient queueClient = _messagingFactory.CreateQueueClient(
queueName, ReceiveMode.PeekLock);
BrokeredMessage brokeredMessage = queueClient.Receive();
while (brokeredMessage != null )
{
brokeredMessage.Complete();
brokeredMessage = queueClient.Receive();
}
Run Code Online (Sandbox Code Playgroud) 我应该如何rowversion使用Entity Framework 比较字段?我有一个表有一个rowversion列,我想从表中获取行版本高于指定值的数据.
byte[] rowversion = ... some value;
_context.Set<T>().Where(item => item.RowVersion > rowVersion);
Run Code Online (Sandbox Code Playgroud)
这行不起作用,它抛出错误:
不能应用于'byte []'和'byte []'类型的操作数
知道如何比较rowversionc#/ EF中的字段吗?
我们可以使用c#读取带有ServiceConfiguration.cscfg文件的证书部分吗?RoleEnvironment类中有方法可以读取ConfigurationSettings,但不能读取证书部分.
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="WindowsAzureProject7" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="MvcWebRole1" >
<Instances count="1" />
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="625FBBB3B7A25C4B9D1C49D1CB1E3AE196C1A083" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Run Code Online (Sandbox Code Playgroud) 我们计划使用azure服务总线队列以及主题/订阅.
对于具有不同过滤条件的给定主题,我们有多个订阅.
我的问题是,我们可以在创建订阅后动态更改订阅过滤器吗?如何在创建订阅后更改过滤条件?我找不到任何允许这种方法?我看到的唯一选择是删除订阅并重新创建它.知道如何更改过滤器而不删除订阅吗?
我们使用统一作为IoC.我们遇到了独特的问题.我们创建了名为IPlugin的接口.该接口在各种第三方供应商之间共享,以基于此接口开发自己的插件.然后这些插件适合我们的系统.供应商将提供他们的插件作为DLL.我们想要的是,使用unity我们想要解析用IPlugin接口实现的所有程序集类型.我发现这可以通过MEF导出属性实现,我想知道这是否可以通过Unity使用一些简短的扩展来实现.
我们的代码
Public interface IPlugin
{
Void ProcessData();
}
Public class DataProcessor
{
Var pluginList = unityContainer.ResolveAssemblies<IPlugIn>()
/*
There is no such method in unity but what we want is scan all assemblies in bin folder and load all types which are inheriting from IPlugIn
*/
}
Run Code Online (Sandbox Code Playgroud)
供应商的集会
Public class AbcCompanyPlugIn : IPlugin
{
Void ProcessData()
{
// some code
}
}
Public class XyzCompanyPlugIn : IPlugin
{
Void ProcessData()
{
// some code
}
}
Run Code Online (Sandbox Code Playgroud)