问题:如何使用WCF提供分布式,可扩展和抗灾的发布/订阅服务.
细节:
请注意,除了消息/中间件解决方案(如Tibco EMS)之外,还考虑采用此方法.
我一直在研究WCF,特别是它如何用于提供pub/sub.关于这个主题,这篇文章非常好:WCF pub-sub.
在文章中,作者试图解决拥有多个发布者的问题(就像在几个框中扩展服务层一样).问题在于,如果客户端A向发布者A注册但发布者B希望发布事件,则发布者B将不知道客户端A.即没有人告诉发布者B客户端A想要通知事件.作者建议将pub/sub服务作为解决方案.发布/订阅服务将集中存储订阅.但是,如果我想通过二级/双发布/订阅服务使pub/sub服务具有抗灾能力,那么我就有了同样的原始问题.
所以,我认为这个问题有几个解决方案:
任何人都可以想到任何其他解决方案(即我没有错过WCF的一些奇妙的魔法功能?)任何评论赞赏.
你认为多少级别的缩进合理?
我觉得拥有带有4/5 +级别缩进的C++函数通常是件坏事.这意味着你必须在心理上始终跟踪4/5 +事物.
我的观点是否合理?
(是的,我可以通过不缩进来避免多级缩进:)
据我所知,当我使用VBA代码创建Excel工作表时,VBA代码将与工作表一起保存为二进制文件.因此,我不能以有用的方式将代码放入源代码控制中,让多个开发人员处理问题,难以区分,等等.
有没有办法围绕这个没有切换到VSTO,COM插件等?例如,要在运行时从Web服务,共享驱动器等加载所有VBA的工作表?任何想法都赞赏.
谢谢.
我正在构建一个WCF服务,它将公开BasicHttp和NetTcp绑定.我还添加了两个相应的Mex端点,即
<service name="WCFTest.CalculatorService" behaviorConfiguration="WCFTest.CalculatorBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8000/WCFTest/CalculatorService/" />
<add baseAddress = "net.tcp://localhost:9000/WCFTest/CalculatorService/" />
</baseAddresses>
</host>
<endpoint address ="basicHttpEP" binding="basicHttpBinding" contract="WCFTest.ICalculatorService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address ="netTcpEP" binding="netTcpBinding" contract="WCFTest.ICalculatorService"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
Run Code Online (Sandbox Code Playgroud)
我真的需要添加NetTcp Mex端点以及BasicHttp Mex端点吗?客户不仅会总是使用Http mex端点进行元数据解析,而不管他们是否要使用tcp进行通信?
谢谢
我有这种复杂的类型:
<xsd:complexType name="Identifier">
<xsd:sequence>
<xsd:element name="Id" type="xsd:string"/>
<xsd:element name="Version" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)
现在我想把它包含在另一个复杂的类型中,我一直在这样做:
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Id" type="Identifier"/>
<!-- More elements here -->
</xsd:sequence>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)
这不是我真正想要的.我想直接在我的第二个复杂类型中包含Identifier类型的元素,而不创建新元素.就像这样做:
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Id" type="xsd:string"/>
<xsd:element name="Version" type="xsd:string"/>
<!-- More elements here -->
</xsd:sequence>
</xsd:complexType>
Run Code Online (Sandbox Code Playgroud)
希望有道理.
提前致谢.
例如,我们有两个域对象:Cell和Body(如人体细胞和身体).
Body类只是Cell的集合,例如
class Body
{
IList<Cell> cells;
public void AddCell(Cell c) { ... }
public void RemoveCell(Cell c) { ... }
}
Run Code Online (Sandbox Code Playgroud)
Cell有一个Split方法,它在内部创建一个自己的克隆,例如
Class Cell
{
public Cell Split()
{
Cell newCell = new Cell();
// Copy this cell's properties into the new cell.
return Cell;
}
}
Run Code Online (Sandbox Code Playgroud)
现在,在DDD中细胞分裂应该:
提前致谢.
我什么时候会在NHibernate已经提供的东西之上编写UoW实现?有真实世界的例子吗?
[编辑1 - 添加第三个指针语法(谢谢Alex)]
您更喜欢DAL的哪种方法以及为什么出于以下原因:
Car& DAL::loadCar(int id) {}
bool DAL::loadCar(int id, Car& car) {}
Car* DAL::loadCar(int id) {}
Run Code Online (Sandbox Code Playgroud)
如果无法找到汽车第一个方法返回null,则第二个方法返回false.
第二种方法是在堆上创建一个Car对象,并使用从数据库中查询的数据进行填充.据推测(我的C++非常生疏),这意味着代码如下:
Car& DAL::loadCar(int id)
{
Car *carPtr = new Car();
Car &car= *carPtr;
car.setModel(/* value from database */);
car.setEngineSize(/* value from database */);
// etc
return car;
}
Run Code Online (Sandbox Code Playgroud)
谢谢
在MS Project中,我可以访问资源表,然后右键单击资源,进入"资源信息"对话框,然后单击"更改工作时间..."并输入该资源的假期,病假或其他缺勤.我想以编程方式从C#访问相同的信息.
我在内存中加载了Microsoft.Office.Interop.MSProject.Project对象,我可以访问任务和其他属性.从Project对象,我可以访问Resource属性(键入Microsoft.Office.Interop.MSProject.Resource),但不知道该类型在何处查找资源的工作时间.
我正在使用VS2008和MS Project 2007.
任何帮助赞赏.
与此问题类似(但在我的情况下不是VSTO SE),我只是想确认在Visual Studio 2005和Excel 2003中使用纯VSTO创建UDF是不可能的 - 所以,绝对清楚,我的问题是:
是否可以使用Visual Studio 2005和VSTO解决方案创建Excel 2003 UDF而无需使用任何VBA或其他技巧?
我知道ManagedXLL,ExcelDNA,Excel4Net等,但暂时不想考虑这些.
谢谢
我开发了一个非常简单的主机和客户端,我想用它来测试WCF客户端是否可以将登录的Windows用户的凭据传递给主机服务,而无需用户重新输入他们的凭据或设置安全性.
我的主机配置如下所示:
<configuration>
<system.serviceModel>
<services>
<service name="WCFTest.CalculatorService" behaviorConfiguration="WCFTest.CalculatorBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8000/WCFTest/CalculatorService/" />
<add baseAddress = "net.tcp://localhost:9000/WCFTest/CalculatorService/" />
</baseAddresses>
</host>
<endpoint address ="basicHttpEP" binding="basicHttpBinding" contract="WCFTest.ICalculatorService" bindingConfiguration="basicHttpBindingConfig"/>
<endpoint address ="netTcpEP" binding="netTcpBinding" contract="WCFTest.ICalculatorService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfig">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="WCFTest.CalculatorBehavior">
<serviceAuthorization impersonateCallerForAllOperations="false" principalPermissionMode="UseWindowsGroups" />
<serviceCredentials >
<windowsAuthentication allowAnonymousLogons="false" includeWindowsGroups="true" />
</serviceCredentials>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我的客户端配置如下所示:
<configuration>
<configSections> …Run Code Online (Sandbox Code Playgroud) 我们有一个配置XML数据库.我不想直接通过数据库API访问它,而是扩展.Net的配置类以添加自定义存储提供程序.
我不知道从哪里开始.我已经看过配置应用程序块,但这似乎已被弃用.我正在使用.Net 3.5.
我应该看哪些课程?我需要实现哪些接口?这是在其他地方完成的吗?
谢谢
c# ×9
wcf ×3
c++ ×2
.net ×1
.net-3.5 ×1
architecture ×1
c#-3.0 ×1
complextype ×1
element ×1
excel ×1
excel-vba ×1
ilist ×1
interface ×1
interop ×1
java ×1
mex ×1
ms-project ×1
nhibernate ×1
reference ×1
unit-of-work ×1
vba ×1
vsto ×1
xsd ×1