public async Task SetUp() { var c1 = await ReplaceOrCreateContainerAsync( new AzCosmos.ContainerProperties { Id = "Persons1", PartitionKeyPath = "/_partitionKey", UniqueKeyPolicy = new AzCosmos.UniqueKeyPolicy { UniqueKeys = { new AzCosmos.UniqueKey { Paths = { "/name"} } } } }, 400); await c1.ImportBatchAsync <CosmosDb, Person1>("Data.yaml"); var c2 = await ReplaceOrCreateContainerAsync( new AzCosmos.ContainerProperties { Id = "Persons2", PartitionKeyPath = "/_partitionKey", UniqueKeyPolicy = new AzCosmos.UniqueKeyPolicy { UniqueKeys = { new AzCosmos.UniqueKey { Paths = { "/name"} } } } }, 400); await c2.ImportBatchAsync <CosmosDb, Person2>("Data.yaml"); var c3 = await ReplaceOrCreateContainerAsync( new AzCosmos.ContainerProperties { Id = "Persons3", PartitionKeyPath = "/_partitionKey", UniqueKeyPolicy = new AzCosmos.UniqueKeyPolicy { UniqueKeys = { new AzCosmos.UniqueKey { Paths = { "/type","/value/name" } } } } }, 400); await c3.ImportValueBatchAsync <CosmosDb, Person3>("Data.yaml"); // Add other random "type" to Person3. var c = new CosmosDbValueContainer <Person1, Person1>(this, CosmosDbArgs.Create(_mapper, "Persons3")); await c.Container.ImportValueBatchAsync(new Person1[] { new Person1 { Id = 100.ToGuid(), Name = "Greg" } }); // Load the reference data. var rd = await ReplaceOrCreateContainerAsync( new AzCosmos.ContainerProperties { Id = "RefData", PartitionKeyPath = "/_partitionKey", UniqueKeyPolicy = new AzCosmos.UniqueKeyPolicy { UniqueKeys = { new AzCosmos.UniqueKey { Paths = { "/type","/value/code" } } } } }, 400); await rd.ImportValueRefDataBatchAsync <ReferenceDataProvider, ReferenceDataProvider>("RefData.yaml"); }
public async Task <RefDataNamespace.PowerSourceCollection> PowerSourceGetAllAsync() { var __coll = new RefDataNamespace.PowerSourceCollection(); await DataInvoker.Current.InvokeAsync(this, async() => { _cosmos.ValueQuery <RefDataNamespace.PowerSource, Model.PowerSource>(CosmosDbArgs.Create(_mapper, "RefData", new Beef.Entities.PagingArgs().OverrideTake(100000))).SelectQuery(__coll); await Task.CompletedTask.ConfigureAwait(false); }).ConfigureAwait(false); return(__coll); }
private IQueryable <Model.Robot> GetByArgsOnQuery(IQueryable <Model.Robot> q, RobotArgs args, CosmosDbArgs dbArgs) { q = q.WhereWildcard(x => x.ModelNo, args?.ModelNo); q = q.WhereWildcard(x => x.SerialNo, args?.SerialNo); q = q.WhereWith(args?.PowerSources, x => args.PowerSources.ToCodeList().Contains(x.PowerSource)); return(q.OrderBy(x => x.SerialNo)); }
private IQueryable <Model.Person> GetByArgsOnQuery(IQueryable <Model.Person> q, PersonArgs?args, CosmosDbArgs dbArgs) { q = q.WhereWildcard(x => x.FirstName, args?.FirstName); q = q.WhereWildcard(x => x.LastName, args?.LastName); q = q.WhereWith(args?.Genders, x => args !.Genders !.ToCodeList().Contains(x.Gender)); return(q.OrderBy(x => x.LastName)); }
public Task DeleteAsync(Guid id) => DataInvoker.Current.InvokeAsync(this, async() => { var __dataArgs = CosmosDbArgs.Create(_mapper, "Items", PartitionKey.None, onCreate: _onDataArgsCreate); await _cosmos.Container <Robot, Model.Robot>(__dataArgs).DeleteAsync(id).ConfigureAwait(false); });
public Task <Robot> UpdateAsync(Robot value) => DataInvoker.Current.InvokeAsync(this, async() => { var __dataArgs = CosmosDbArgs.Create(_mapper, "Items", PartitionKey.None, onCreate: _onDataArgsCreate); return(await _cosmos.Container <Robot, Model.Robot>(__dataArgs).UpdateAsync(Check.NotNull(value, nameof(value))).ConfigureAwait(false)); });