public RegistrarServidorCommandHandler(IBaseRepository <Model.Servidor> servidorRepository, ICollectionContext <Model.Servidor> servidorCollection, IMediator mediator, ILogger <RegistrarServidorCommandHandler> logger)
 {
     _servidorRepository = servidorRepository;
     _servidorCollection = servidorCollection;
     _mediator           = mediator;
     _logger             = logger;
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 public CollectionSequenceSelectionContext(
     ICollectionContext <TPoco, TCollection> parentContext,
     IEnumerable <IObjectGenerator <TPoco> > generators,
     int initialPull)
 {
     mAllGenerators = generators;
     mCurrentCount  = 0;
     mCurrentSkip   = 0;
     mParentContext = parentContext;
     Next(initialPull);
 }
Exemplo n.º 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;
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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());
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 12
0
        public void List_UnknownType_ReturnsObjectGenerator()
        {
            ICollectionContext <SimpleUser, IList <SimpleUser> > userGenerator = mGenerationSession.List <SimpleUser>(10);

            Assert.NotNull(userGenerator);
        }
Exemplo n.º 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;
 }
Exemplo n.º 15
0
        public void List_ValidType_ReturnsCollectionContext()
        {
            ICollectionContext <SimpleUser, IList <SimpleUser> > userGenerator = mGenerationSession.List <SimpleUser>(10);

            Assert.NotNull(userGenerator);
        }
Exemplo n.º 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);
        }
Exemplo n.º 18
0
 public UserContextTest()
 {
     userContext = new UserContext();
 }
 public CollectionRepository(ICollectionContext context)
 {
     this.context = context;
 }
Exemplo n.º 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);
        }
Exemplo n.º 22
0
 private bool HasIndexes(ICollectionContext collection)
 {
     return(collection?.Count() > 0);
 }
Exemplo n.º 23
0
 public PostContextTest()
 {
     postContext = new PostContext();
 }
Exemplo n.º 24
0
 public DataTransferCollection(IList <T> list, ICollectionContext context)
     : base(list)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }