本文整理汇总了C#中EventSource.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# EventSource.GetType方法的具体用法?C# EventSource.GetType怎么用?C# EventSource.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventSource
的用法示例。
在下文中一共展示了EventSource.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetForEventSource
#pragma warning disable 1591 // Xml Comments
public CommittedEventStream GetForEventSource(EventSource eventSource, Guid eventSourceId)
{
var eventPath = GetPathFor(eventSource.GetType().Name, eventSourceId);
var files = Directory.GetFiles(eventPath).OrderBy(f => f);
var stream = new CommittedEventStream(eventSourceId);
var target = new EventHolder
{
Type = typeof(string),
Version = EventSourceVersion.Zero,
Event = string.Empty
};
foreach (var file in files)
{
var json = File.ReadAllText(file);
_serializer.FromJson(target, json);
var @event = _serializer.FromJson(target.Type, json) as IEvent;
stream.Append(new[] { @event });
}
return stream;
}
示例2: GetSchema
/// <summary>
/// Gets the schema for the specified event source.
/// </summary>
/// <param name="eventSource">The event source.</param>
/// <returns>The event schema.</returns>
public IDictionary<int, EventSchema> GetSchema(EventSource eventSource)
{
Guard.ArgumentNotNull(eventSource, "eventSource");
return this.GetSchema(EventSource.GenerateManifest(eventSource.GetType(), null));
}
示例3: GetMethodFromSchema
private MethodInfo GetMethodFromSchema(EventSource source, EventSchema schema)
{
return source.GetType().GetMethods(Bindings).SingleOrDefault(m => this.IsEvent(m, schema.Id)) ??
source.GetType().GetMethod(schema.TaskName, Bindings);
}
示例4: GetEventSchemas
private ICollection<EventSchema> GetEventSchemas(EventSource eventSource)
{
try
{
string manifest = EventSource.GenerateManifest(eventSource.GetType(), null);
this.CheckForBadFormedManifest(manifest);
return new EventSourceSchemaReader().GetSchema(manifest).Values;
}
catch (EventSourceAnalyzerException)
{
throw;
}
catch (Exception e)
{
throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.EventSourceAnalyzerManifestGenerationError, e.Message, EventSource.GenerateManifest(eventSource.GetType(), null)));
}
}
示例5: GetLastCommittedVersion
public EventSourceVersion GetLastCommittedVersion(EventSource eventSource, Guid eventSourceId)
{
var eventPath = GetPathFor(eventSource.GetType().Name, eventSourceId);
var first = Directory.GetFiles(eventPath).OrderByDescending(f => f).FirstOrDefault();
if (first == null) return EventSourceVersion.Zero;
var json = File.ReadAllText(first);
var target = new EventHolder
{
Type = typeof(string),
Version = EventSourceVersion.Zero,
Event = string.Empty
};
_serializer.FromJson(target, json);
return target.Version;
}
示例6: GetEventSchemas
private ICollection<EventSchema> GetEventSchemas(EventSource eventSource)
{
if(eventSource == null)
throw new ArgumentNullException("eventSource");
try
{
var manifest = EventSource.GenerateManifest(
eventSource.GetType(),
Assembly.GetAssembly(eventSource.GetType()).Location
);
this.CheckForBadFormedManifest(manifest);
return new EventSourceSchemaReader().GetSchema(manifest).Values;
}
catch (EventSourceAnalyzerException)
{
throw;
}
catch (Exception e)
{
if (eventSource.ConstructionException != null)
{
throw new EventSourceAnalyzerException(
e.Message,
eventSource.ConstructionException
);
}
throw new EventSourceAnalyzerException(
string.Format(
CultureInfo.CurrentCulture,
Resources.EventSourceAnalyzerManifestGenerationError,
e.Message,
EventSource.GenerateManifest(
eventSource.GetType(),
null
)));
}
}