crokus / cosmosdb-repo Goto Github PK
View Code? Open in Web Editor NEWRepository pattern for Cosmos DB
Home Page: https://www.nuget.org/packages/DocumentDB.Repository/1.0.0
License: MIT License
Repository pattern for Cosmos DB
Home Page: https://www.nuget.org/packages/DocumentDB.Repository/1.0.0
License: MIT License
Hi there. I really love this library.
I'm using the 1.1.0 Nuget Package version and it doesn't seem to include the Interface for DocumentDbRepository yet. Any plans to update the Nuget package? Thanks a lot!
Hi,
I want to use AddOrUpdateAsync and return its result but it doesn't work.
public async Task<CompanyVm> CreateCompanyAndReturn(CompanyVm companyItem)
{
var result = await base.Repository.AddOrUpdateAsync(companyItem);
return result;
}
Also I tried
public CompanyVm CreateCompanyAndReturn(CompanyVm companyItem)
{
var result = base.Repository.AddOrUpdateAsync(companyItem).Result;
return result;
}
This code works
public async void CreateCompany(CompanyVm companyItem)
{
var result = await base.Repository.AddOrUpdateAsync(companyItem);
}
Hi,
Your project looks very good. Is it available as a Nuget package?
Best,
Søren
Bug in class DocumentDbRepository.cs. Line 37 must be executed before line 35, otherwise an Exception will be thrown in method GetOrCreateCollectionAsync() line 189: collection = await _client.CreateDocumentCollectionAsync((await _database).SelfLink, collection);
because collection is always null.
Consider the following POCO
public class Foo
{
[JsonProperty(PropertyName = "id")]
public Guid MessageUid { get; set; }
}
Using this POCO throw's an exception at the line 👍
var exp = Expression.Lambda<Func<T, string>>(body, p);
I'm currently learning and researching lamba's as I don't expression building very well but any help would be most welcome.
The FirstOrDefaultAsync(Func<T, bool> predicate) method takes the predicate 'Func<T, bool> predicate' which is taking a lot of time to execute, instead of Func<T, bool> predicate if we change to 'Expression<Func<T, bool>> predicate' it is working much faster ( at least 10 times faster).Is it an issue or a behavior?
The other issue with RemoveAsync is not working with the partitioned collection is because of even if 'RemoveAsync' method takes RequestOptions as a parameter which is not passed to GetDocumentByIdAsync(id).We might need a Get method which takes partition key as FeedOptions.
The WhereAsync methods return an IQueryable which is fine for most cases, but there are some issues I have faced with sharing context when WhereAsync used in the fully async code.It is very useful if you could provide an option for WhereAsync which returns the result after enumeration, like a List or similar.
update to the latest azure documentdb package
For people who use it as Nuget package that would be really helpful. You've done a great work thanks!
Hi,
I'm having strange issue with performance of GetById queries - while any other query takes no longer than 1 sec (this is locally deployed app connecting to Azure), GetById query takes 15+ seconds.
So far I'm working with relatively small dataset (between 1-2 thousands documents). I am using GUIDs for Id property.
I tried to play a bit with indexing but DocumentDB will not allow me to directly index Id field so I'm using:
{
"path": "/*",
"indexes": [
{
"kind": "Hash",
"dataType": "String",
"precision": -1
},
{
"kind": "Hash",
"dataType": "Number",
"precision": 7
}
]
}
In my code, I declare my repo like this:
_repoAggregationLog = new DocumentDbRepository<AggregationLog>(client, databaseId, () => "vd", p => p.Id);
and it is declared as singleton for application lifetime, i.e. this is executed only once, not with every query.
Any idea what I can be doing wrong? Or is it normal that queries by document ID takes so long?
Many thanks,
Antonin
I'd like to be able to mock the repository in unit tests so having it implement an interface would be great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.