private void CreateUserEvent(User user, UserEventType type, RequestData request) { UserEvent @event = new UserEvent() { UserEventId = Guid.NewGuid(), User = user, EventType = (int)type, EventDateTime = DateTime.UtcNow }; CompleteUserEvent(@event, request); this.context.UserEvents.AddObject(@event); this.context.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the UserEvents EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUserEvents(UserEvent userEvent) { base.AddObject("UserEvents", userEvent); }
private static void CompleteUserEvent(UserEvent @event, RequestData request) { if (request != null) { @event.Url = request.Url; @event.UserAgent = request.UserAgent; @event.RemoteMachine = request.RemoteMachine; @event.SessionId = request.SessionId; } }
/// <summary> /// Create a new UserEvent object. /// </summary> /// <param name="userEventId">Initial value of the UserEventId property.</param> /// <param name="eventType">Initial value of the EventType property.</param> /// <param name="eventDateTime">Initial value of the EventDateTime property.</param> public static UserEvent CreateUserEvent(global::System.Guid userEventId, global::System.Int32 eventType, global::System.DateTime eventDateTime) { UserEvent userEvent = new UserEvent(); userEvent.UserEventId = userEventId; userEvent.EventType = eventType; userEvent.EventDateTime = eventDateTime; return userEvent; }