public RegistrarServidorCommandHandler(IBaseRepository <Model.Servidor> servidorRepository, ICollectionContext <Model.Servidor> servidorCollection, IMediator mediator, ILogger <RegistrarServidorCommandHandler> logger)
 {
     _servidorRepository = servidorRepository;
     _servidorCollection = servidorCollection;
     _mediator           = mediator;
     _logger             = logger;
 }
        public static T CreateDocument <T>(ICollectionContext context, T doc) where T : Resource
        {
            var response = context.Client.CreateDocumentAsync(context.CollectionUri, doc).Result;

            Debug.WriteLine(String.Format("Create response request charge: {0}", response.RequestCharge));
            return((dynamic)response.Resource);
        }
        public static void DeleteDocument <T>(ICollectionContext context, T doc, object partitionKeyValue) where T : Resource
        {
            var response = context.Client.DeleteDocumentAsync(doc.SelfLink, new RequestOptions()
            {
                PartitionKey = new PartitionKey(partitionKeyValue)
            }).Result;

            Debug.WriteLine(String.Format("Delete response request charge: {0}", response.RequestCharge));
        }
示例#4
0
 public CollectionSequenceSelectionContext(
     ICollectionContext <TPoco, TCollection> parentContext,
     IEnumerable <IObjectGenerator <TPoco> > generators,
     int initialPull)
 {
     mAllGenerators = generators;
     mCurrentCount  = 0;
     mCurrentSkip   = 0;
     mParentContext = parentContext;
     Next(initialPull);
 }
示例#5
0
 public ProgramarDescargaCommandHandler(
     IBaseRepository <Model.Descarga> descargaRepository,
     ICollectionContext <Model.Contenido> contenidoCollection,
     IBaseRepository <Model.Servidor> servidorRepository,
     ILogger <ProgramarDescargaCommandHandler> logger, AppSettings appSettings)
 {
     _descargaRepository  = descargaRepository;
     _contenidoCollection = contenidoCollection;
     _servidorRepository  = servidorRepository;
     _logger      = logger;
     _appSettings = appSettings;
 }
        public static FeedResponse <T> RequestDocumentByAttribute <T>(ICollectionContext context, object PartitionKeyValue, NameValueCollection equalityAttributes) where T : Resource, IPartitionedDocument
        {
            var request = context.Client.CreateDocumentQuery <T>(context.CollectionUri
                                                                 , String.Format("SELECT * FROM c WHERE c.id = \"{0}\"", 1)
                                                                 , new FeedOptions()
            {
                PartitionKey = new PartitionKey(PartitionKeyValue)
            }
                                                                 )
                          .AsDocumentQuery();

            return(request.ExecuteNextAsync <T>().Result);
        }
示例#7
0
 public ReplicaSet(
     DateTimeOffset date,
     IReadOnlyCollection <T> values,
     ICollectionContext context,
     DateTimeOffset?expires      = null,
     DateTimeOffset?lastModified = null
     )
 {
     Date         = date;
     Values       = values;
     Context      = context;
     Expires      = expires;
     LastModified = lastModified;
 }
        public static FeedResponse <T> RequestDocument <T>(ICollectionContext context, string Id, object PartitionKeyValue) where T : Resource, IPartitionedDocument
        {
            var request = context.Client.CreateDocumentQuery <T>(context.CollectionUri
                                                                 , String.Format("SELECT * FROM c WHERE c.id = \"{0}\"", Id)
                                                                 //, new FeedOptions() { PartitionKey = new PartitionKey(PartitionKeyValue) }
                                                                 //, new FeedOptions() { EnableCrossPartitionQuery = true }
                                                                 , new FeedOptions()
            {
                EnableCrossPartitionQuery = true, MaxDegreeOfParallelism = 1
            }

                                                                 )
                          .AsDocumentQuery();

            return(request.ExecuteNextAsync <T>().Result);
        }
        public static T GetDocument <T>(ICollectionContext context, String Id = null, object partitionKeyValue = null) where T : Resource
        {
            var request = context.Client.CreateDocumentQuery <T>(context.CollectionUri
                                                                 , String.Format("SELECT * FROM c WHERE c.id = \"{0}\"", Id)
                                                                 , new FeedOptions()
            {
                PartitionKey = new PartitionKey(partitionKeyValue)
            }
                                                                 )
                          .AsDocumentQuery();

            FeedResponse <T> response = request.ExecuteNextAsync <T>().Result;

            Debug.WriteLine(String.Format("Read response request charge: {0}", response.RequestCharge));

            return(response.AsEnumerable().FirstOrDefault());
        }
示例#10
0
        public static T ReadDocument <T>(ICollectionContext context, String documentId
                                         , object partitionKeyValue = null
                                         ) where T : Document
        {
            Uri docUri = context.DocumentUri(documentId);

            var response = context.ProcessResourceResponse(
                String.Format("Read Document by id ({0}), partition ({1})", documentId, partitionKeyValue),
                context.Client.ReadDocumentAsync(
                    docUri
                    , new RequestOptions()
            {
                PartitionKey = new PartitionKey(partitionKeyValue)
            }
                    )
                .Result);

            return((dynamic)response.Resource);
        }
示例#11
0
        public static void ReplaceDocument <T>(ICollectionContext context, T doc) where T : Resource
        {
            var response = context.Client.ReplaceDocumentAsync(context.DocumentUri(doc.Id), doc).Result;

            Debug.WriteLine(String.Format("Replace response request charge: {0}", response.RequestCharge));
        }
示例#12
0
        public void List_UnknownType_ReturnsObjectGenerator()
        {
            ICollectionContext <SimpleUser, IList <SimpleUser> > userGenerator = mGenerationSession.List <SimpleUser>(10);

            Assert.NotNull(userGenerator);
        }
示例#13
0
 public static FeedResponse <T> RequestDocument <T>(ICollectionContext context, T doc) where T : Resource, IPartitionedDocument
 {
     return(RequestDocument <T>(context, doc.Id, doc.PartitionKeyValue));
 }
 // Token: 0x06001453 RID: 5203 RVA: 0x000755E3 File Offset: 0x000737E3
 public InferenceDataCollectionAssistant(DatabaseInfo databaseInfo, LocalizedString name, string nonLocalizedName, IDiagnosticLogger diagnosticLogger, ICollectionContext collectionContext) : base(databaseInfo, name, nonLocalizedName)
 {
     this.tracer = ExTraceGlobals.GeneralTracer;
     this.tracer.TraceFunction((long)this.GetHashCode(), "InferenceDataCollectionAssistant.InferenceDataCollectionAssistant");
     this.diagnosticLogger  = diagnosticLogger;
     this.collectionContext = collectionContext;
 }
示例#15
0
        public void List_ValidType_ReturnsCollectionContext()
        {
            ICollectionContext <SimpleUser, IList <SimpleUser> > userGenerator = mGenerationSession.List <SimpleUser>(10);

            Assert.NotNull(userGenerator);
        }
示例#16
0
 private static void UpdateProgress(ICollectionContext ctx, ProgressTask progressTask)
 {
     progressTask.MaxValue(ctx.ResultTotal);
     progressTask.Increment(ctx.ResultCount);
 }
        public static ICollectionContext <TPoco, TCollection> Call <TPoco, TCollection, TMember>(this ICollectionContext <TPoco, TCollection> context, Func <TPoco, TMember> func)
            where TCollection : ICollection <TPoco>
        {
            var collectionContext = ((CollectionContext <TPoco, TCollection>)context);
            var generators        = (IEnumerable <IObjectGenerator <TPoco> >)collectionContext.GetFieldValue("mGenerators", Flags.InstancePrivate);

            foreach (var generator in generators.OfType <ObjectGenerator <TPoco> >())
            {
                generator.AddAction(new ObjectMethodInvokeFuncAction <TPoco, TMember>(func));
            }
            return(context);
        }
示例#18
0
 public UserContextTest()
 {
     userContext = new UserContext();
 }
 public CollectionRepository(ICollectionContext context)
 {
     this.context = context;
 }
示例#20
0
        public static void UpsertDocument <T>(ICollectionContext context, T doc) where T : Resource
        {
            var response = context.Client.UpsertDocumentAsync(context.CollectionUri, doc).Result;

            Debug.WriteLine(String.Format("Upsert response request charge: {0}", response.RequestCharge));
        }
        public static ICollectionContext <TPoco, TCollection> SourceForPrivatePropety <TPoco, TCollection, TMember>(this ICollectionContext <TPoco, TCollection> context, Expression <Func <TPoco, TMember> > propertyExpr, IDatasource dataSource)
            where TCollection : ICollection <TPoco>
        {
            var member = ReflectionHelper.GetMember(propertyExpr);

            var collectionContext = ((CollectionContext <TPoco, TCollection>)context);
            var generators        = (IEnumerable <IObjectGenerator <TPoco> >)collectionContext.GetFieldValue("mGenerators", Flags.InstancePrivate);

            foreach (var generator in generators.OfType <ObjectGenerator <TPoco> >())
            {
                generator.AddAction(new PrivateMemberSetFromSourceAction(member, dataSource));
            }
            return(context);
        }
示例#22
0
 private bool HasIndexes(ICollectionContext collection)
 {
     return(collection?.Count() > 0);
 }
示例#23
0
 public PostContextTest()
 {
     postContext = new PostContext();
 }
示例#24
0
 public DataTransferCollection(IList <T> list, ICollectionContext context)
     : base(list)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }