-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api restructure #125
Api restructure #125
Conversation
@ahmednfwela we can drop support for netstandard2.0 and bring it up to 2.1 if it's gonna be of some help. also pls keep the performance benchmarks in mind as well. we don't wann loose too much when compared against the official driver. and have you had a chance to see if relationships can be supported with your restructure/multi-tenancy? also if there's anything i can do to help, pls let me know. good luck brotha! |
For relationships, here is what we could do: To solve this we have 2 ways
In my opinion the second option is better, since it's less intrusive and more maintainable, but it will break the existing api since it depends strictly on I will push some commits with what I think should be the right pattern to use, and see if it's ok. |
yeah no worries. let's break the many/one api if need be. |
@dj-nitehawk please check the latest commit, I split Find into 2 classes
if you like this pattern, we can generalize it for the other classes too |
yeah looks good... go for it 👍 |
@dj-nitehawk I refactored the builders now, and they look way cleaner than before P. S. also enabled nullable in the entire project |
yes i've been following your work. looks awesome!!! |
@ahmednfwela I am reviewing your work, it's moving along quite well. It seems we have many common coding style. Note1: (Maybe) Instead of MongoContext, consider renaming to ServerContext; it is more general Note2: I think we don't need to "hardcode" the notion of tenantId into the database naming; and leave that logic to the Dependency injection that way we don't need to "force" anyone to use a specific pattern for naming the DBs. |
@bobbyangers yes, I think I will remove the tenant id altogether and let the tenancy handling out of the Context |
@ahmednfwela, it's looking better and better. if I can do something to help, let me know. |
@bobbyangers maybe you could start on supporting multi-tenancy while I do the remaining refactoring? |
Hi @ahmednfwela, yes I will do that, but as an contrib extension, not in the main package. |
MongoDB.Entities/Core/FileEntity.cs
Outdated
/// <summary> | ||
/// Access the DataStreamer class for uploading and downloading data | ||
/// </summary> | ||
public DataStreamer Data => streamer ??= new DataStreamer(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to break the api here? or will you be adding this back in later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, since DataStreamer
needs to get FileChunk
collection, it needs to know about the DBContext
, so we would either have to
- pass the
DBContext
to theFileEntity
just to be used innew DataStreamer(this, db);
- or leave the creation of
DataStreamer
to theDBContext
(better)
@dj-nitehawk @bobbyangers I made the this means that we don't even assume collections are in the same database as the context, e.g. Context.Find<T>(collection: someCollectionInAnotherDataBase) this is useful for applying |
@ahmednfwela can you reinvite me please ? I seems, that my initial confirmation was incomplete. Also; I also wanted to check with you; is the project compiling now ? |
@bobbyangers well, not yet, I am a little busy nowadays, so I didn't have time to finish yet. |
@ahmednfwela you should pull the latest changes from |
@ahmednfwela what is the status of the work ? And what is left to do ? |
I am currently researching how to do relationships efficiently. |
@ahmednfwela ok let's remove the static stuff if it makes it easier to maintain the project in the long-run. so yeah go ahead, rip that shit out 😜 |
well, that took a load off my chest |
@ahmednfwela have you given any thought to how migrations should be done now? |
well, I am going to move migration to be per |
@ahmednfwela i added you as a collaborator to this repo. here's what i'm thinking about how to proceed with this refactor.
what do you think? |
sure, that sounds like a good plan! |
vNext should be branched off from multi-tenancy though |
yeah go ahead and create it however you like. or just rename "multi-tenancy" to "vNext" and pull in your changes. |
done |
@ahmednfwela will you merge and close this PR into vnext? or you wanna keep working on your fork and merge later? |
I will merge it to vNext once it can actually compile, then we can do multiple PRs onto vNext later |
I also removed all dependency on |
@dj-nitehawk i will merge this for now (even tho project isn't building) |
This PR is to restructure the API under the following targets
DBContext
targets a single databaseMongoContext
targets a MongoDB connection which allows accessing multipleDBContext
s (multiple databases)MongoContext
with a singletonDBContext
for convenience to use when no DI containers are being usedMongoContext
s andDBContext
s should be cheap to create, cachable and configurableMongoContext
will store connection-level mappings and convention, whileDBContext
will store Database-level mappings and conventionssolves #124
solves #123
solves #126