public static Task <TResult> CreateAsync <TResult>(Guid id,
                                                           Guid authenticationId, DateTime time, string method, string controller, string content,
                                                           Func <TResult> onSuccess)
        {
            var doc = new MonitoringDocument();

            doc.monitoringDocumentRef = id.AsRef <MonitoringDocument>();
            doc.AuthenticationId      = authenticationId;
            doc.Time       = time;
            doc.Method     = method;
            doc.Controller = controller;
            doc.Content    = content;

            return(doc.StorageCreateAsync(
                       (discard) => onSuccess(),
                       () => throw new Exception("Guid not unique")));
        }
Пример #2
0
        public static Task <TResult> CreateAsync <TResult>(Guid id, Guid authenticationId, DateTime time, string method, string controller, string content,
                                                           AzureStorageRepository repo,
                                                           Func <TResult> onSuccess)
        {
            var doc = new MonitoringDocument();

            doc.AuthenticationId = authenticationId;
            doc.Time             = time;
            doc.Method           = method;
            doc.Controller       = controller;
            doc.Content          = content;

            var monthBucketedPartitionKey = GenerateMonthBucketedPartitionKey(time);

            return(repo.CreateAsync(id, monthBucketedPartitionKey, doc,
                                    () => onSuccess(),
                                    () => throw new Exception("Guid not unique")));
        }