/// <inheritdoc />
        public async Task <TQueryModel> FindEqualOrLessAsync(string id, int fromVersion)
        {
            var filterByPartition = TableQuery.GenerateFilterCondition(nameof(TableEntity.PartitionKey), QueryComparisons.Equal, id);
            var filterByRowKey    = TableQuery.GenerateFilterCondition(nameof(TableEntity.RowKey), QueryComparisons.GreaterThanOrEqual, GetRowKey(fromVersion));
            var filter            = TableQuery.CombineFilters(filterByPartition, TableOperators.And, filterByRowKey);

            var query = new TableQuery <ImmutableTableEntity <TQueryModel> >()
                        .Where(filter)
                        .Take(1);

            var result = await TableProxy.ExecuteQuerySegmentedAsync(query, null);

            return(result.FirstOrDefault()?.DeserializeData());
        }
Exemplo n.º 2
0
        protected override void WriteInternal(LogLevel level, object message, Exception exception)
        {
            String msgText = null;

            if (message == null)
            {
                msgText = "";
            }
            else if (message is string)
            {
                msgText = (String)message;
            }
            else
            {
                var conv = TypeDescriptor.GetConverter(message.GetType());
                if (conv.CanConvertTo(typeof(string)))
                {
                    msgText = (string)conv.ConvertTo(message, typeof(string));
                }
            }

            var le = new LogEvent
            {
                LoggerName          = _loggerName,
                Level               = level,
                Message             = msgText,
                ExceptionStackTrace = exception != null?exception.ToString() : null,
                                          CreatedDate = DateTime.UtcNow
            };

            try
            {
                le.ThreadId     = System.Threading.Thread.CurrentThread.ManagedThreadId.ToString(null as IFormatProvider);
                le.DeploymentId = RoleEnvironment.IsAvailable ? RoleEnvironment.DeploymentId : "N/A";
                le.RoleName     = RoleEnvironment.IsAvailable ? RoleEnvironment.CurrentRoleInstance.Role.Name : "N/A";
            }
            catch (Exception exLog) //lack of ability to load these should not prevent logging from occuring.
            {
                if (le.ExceptionStackTrace == null)
                {
                    le.ExceptionStackTrace = "No Exception in event, but the following occured while logging the event.";
                }
                le.ExceptionStackTrace += String.Format("  {0}{1}", Environment.NewLine, exLog);
            }

            TableProxy.Insert(le);
        }
Exemplo n.º 3
0
 public virtual void VisitTableStart(TableProxy table)
 {
 }
Exemplo n.º 4
0
 public virtual void VisitTableEnd(TableProxy table)
 {
 }