serenity-is / Serenity

Business Apps Made Simple with Asp.Net Core MVC / TypeScript
https://serenity.is
MIT License
2.59k stars 795 forks source link

Can I use Serenity with a NoSQL db? #349

Closed joaolongo closed 8 years ago

joaolongo commented 8 years ago

I am currently developing a LMS platform and I'd like to use Serenity on the Admin part of the website. The problem is I am using MongoDb as main database. Can Serenity be integrated used with MongoDb? I already have a "ORM" that i updated so i could make my life easy with Mongo drivers.

volkanceylan commented 8 years ago

UI part can be used with any backend but you need to write your own service handlers for this. Especially entity system (row) and ListRequestHandler is SQL oriented. I don't think MongoDB can execute SQL right? If so, you need to change endpoint List code for example, that takes a ListRequest, converts it into a query usable with MongoDB and return ListResponse.

joaolongo commented 8 years ago

I already have the code to make the convertions, i will check those endpoints tonight and see if it's already usable on Serenity. But I think it's going to, because the ORM like tool I am using is really adaptable, about the specific objects, it already handles BSON convertion to me. =]

joaolongo commented 8 years ago

About the integration between MongoDb and Serenity... I am currently developing a library to isolate MongoDb, if i succeed, Serenity won't even know it's actually connected to a MongoDb engine. I am currently having a slow progress as I am developing two projects with serenity and I had to abandon the MongoDb approach in one of them... But for the time being the LMS platform will continue to use MongoDb as database.

volkanceylan commented 8 years ago

Thanks @joaolongo, i'd like to know about further updates. Let me know if there is something i can help you with.

joaolongo commented 8 years ago

Hello, I am currently on a dead end. Serenity as it is right uses migrations to create database and then generate pages and models... The thing is, MongoDb creates the collections on demand. This doesn't mean it's impossible to create a collection without basic data, but I think that I would need to create a library that can replace the migrations function. That being said, could you provide me with a list of the endpoints that I would need to replace on Serenity's source code? I think that I would progress a a little faster. Another point to highlight is that I will have to make database changes on the WPF project as well (i know it's a little obvious but it's good to point this out =] ). Anyway, I was also wondering if Serenity would be loose coupled enough in order to unplug sql server, plug Mongo (or another database). Do you have suggestions on how to make a choice option where we can switch between mongo and other DBs?

volkanceylan commented 8 years ago

You don't have to handle migrations, you can simply skip them if they are not feasible in MongoDB. Serenity doesn't depend on migrations. Serene runs them using FluentMigrator. You might create a dialect IMongoDbDialect for example to use conditional statements. Anyway Serenity doesn't have any endpoints, Serene (template) does. You should handle UserEndpoint, UserPermissionEndpoint at minimum, or write your own IPermissionService etc.

joaolongo commented 8 years ago

I see, then I will start making a dialect and start working on the services.

volkanceylan commented 8 years ago

Any updates on this, or you gave up?

joaolongo commented 8 years ago

I'm still working on it, but with small progress, as right now I have to much to do in my hands. As soon as I have a workable version I will update you.

PS: Sorry for the (really) delayed response.

samdubey commented 8 years ago

+1 for NOSQL Db

kpetersondev commented 8 years ago

I hope to give the MongoDB customization a try whenever it is ready. I know this will be very helpful to my future projects and will help a lot of developers as well. I wish I could assist but I'm just working on the basics at this stage and using SQL for now. @joaolongo may the force be with you!

samdubey commented 3 years ago

has anyone consider cassandra (it has fairly similar syntax like sql called CQL)

teafmartins commented 1 year ago

@joaolongo Any updates with MongoDB ? Conseguiste adaptar o ao MondoDB ? :)