我在我的SF服务(称为WebSvc)的PackageRoot下创建了一个包含License.xml文件的数据包,如下所示:
ApplicationTypePackageRoot - > WebSvcPkg - > Data - > License.xml
现在在我的C#代码中,我想获得License.xml文件的完整路径.这该怎么做?
我正在使用 DDD 设计 CQRS 应用程序,并且想知道如何实现以下场景:
Participant聚合可以被多个引用ParticipantEntry聚合AddParticipantInfoCommand发送到 Command 端,其中包含Participantand one 的所有信息ParticipantEntry(类似于 an Orderand one OrderLineItem)应该在哪里实现检查 Participant 是否已经存在的逻辑,如果它不存在,则创建 Participant?
Participant,如果没有找到,则发出AddParticipantCommand一个AddParticipantEntry命令,然后发出包含Participant ID?我有一个通用的方法
public async Task Save<T>(T aggregate) where T : AggregateRoot
Run Code Online (Sandbox Code Playgroud)
从这个方法我调用另一个泛型方法
var indexRegistrations = IndexRegistrar.GetAll<T>();
Run Code Online (Sandbox Code Playgroud)
现在在第二个通用方法中,我想得到真正的类型T,它是一个子类型AggregateRoot:
public static List<IndexRegistration> GetAll<T>() where T : AggregateRoot
{
return _register.FindAll(r => r.aggregateType == typeof(T));
}
Run Code Online (Sandbox Code Playgroud)
但是,typeof(T)总是返回AggregateRoot.
我怎样才能得到真实的类型(=子类型AggregateRoot)T?