Пример #1
0
 public EventPublicationRecord(IEvent ev)
 {
     Status          = EventPublicationStatus.Unpublished;
     Id              = ev.PublicationRecordId;
     PortableEvent   = new PortableEvent(ev, EventSchemaGenerator.GenerateSchema(ev.GetType()));
     Created         = DateTime.UtcNow;
     QueryReferences = new EditableList <IdentifierQueryReference>();
 }
Пример #2
0
        public EventDescription(Type eventType, bool includeDetails) : base(eventType.Name, eventType.Namespace)
        {
            EmptyModel = Activator.CreateInstance(eventType);

            var eventSchema = EventSchemaGenerator.GenerateSchema(eventType);

            Schema = new SchemaObject(eventSchema, Name, Namespace);

            Links = new List <JsonLink>()
            {
                new JsonLink(string.Format("/api/events/{0}/{1}/publish", Namespace, Name), "publication"),
            };

            if (includeDetails)
            {
                Links.Add(new JsonLink(string.Format("/api/events/{0}/{1}", Namespace, Name), "details"));
            }
            else
            {
                Links.Add(new JsonLink("/api/events/", "home"));
            }
        }