I'm using sails framework with sails-mongo adapter as orm, I want to test models and controllers so I want a factory to provide model objects. When I use sql databases I use factory-girl with sequelize as ORM, so I want an equivalent for mongo databases. I know there is an adapter for factory girl using mongoose, but nevertheless I read that is recommended to use sails-mongo (waterline) for sails framework instead of moongose.
Do you know a factory or how can I create objects(with associations) for this?
Thanks in advance.
Related
I could not find any documentation on this topic. For example, I can create the model classes in Eclipse using the JPA plugin.
Is there a way to create the Entity classes in Micronaut from an
existing SQL database?
If you mean a tool that is part of Micronaut that will read your schema and generate source code for Micronaut entities, the answer is that there is no such capability provided by Micronaut.
I have a question here that what is the difference between schema-based solution and ORM like EntityFrameWork is an ORM and Mongoose is an schema-based solution. Both of them are the same thing or not ? if not then why ?
At a very basic level, yes, they do have some common functionality.
A 'full-fat' ORM, like entity framework will have alot more that simple record to object mapping though.
for example, EF can take data from several tables and map them to a single class, it can supply validation, linking and other useful stuff at the application layer which Mongoose, or the MongoC#Driver cannot do.
Could anyone please tell me how MongoDB can be used with YII?
How can we create controller and model functions using Gii if the database used is MongoDB?
I've used YiiMongoDBSuite (YMDS), which has some very rough support for Gii. You can generate starter classes, but given that MongoDB does not have a fixed schema you will need to edit the model to make them useful. There is an odd kludge that lets you generate MongoDB models from a SQL table, but this seems more effort than it's worth.
YMDS' EMongoDocument class extends the standard Yii CModel class, so this is a useful base if you want to build apps with CRUDS.
The unfortunate caveat is that YMDS is no longer maintained by the original author, and there are a few community forks to chose between.
The way of creating controllers is same as usual but you have to use an extension to talk to mongoDB from Yii ,
You need to use direct Mongo suite of yii . It is an extension which has a collection of components for the mongoDB .
In this forum here , someone mentions that Entity Framework does not work with Access (Jet DB - .mdb). However it seems that there is a provider for Jet DB as described here
Which makes me think that the only thing I need with Entity Framework is to define the follwing before I define the models:
<connectionStrings>
<add name="ProductContext"
providerName="Microsoft.Jet.OLEDB.4.0"
connectionString="Source=C:\mydatabase.mdb;Jet OLEDB:Database
Password=MyDbPassword;"/>
</connectionStrings>
Does anyone know if Entity Framework works fine with Jet DB, I want to make sure it does before I start since my design document depends on this fact.
Thanks
Entity Framework does not support OLEDB connections, so your connection string will not work. It is practically impossible to get Entity Framework to collaborate with MS Access. You will either need to dump the MS Access part of your design, or the Entity Framework part.
The closest you could get using MS Access is using strongly typed datasets and Linq-to-DataSet http://msdn.microsoft.com/en-us/library/bb386977.aspx
Or, considering going with SQL Express instead (it's free) http://www.microsoft.com/sqlserver/en/us/editions/2012-editions/express.aspx
There is a MS Access EF 6.1 provider here
https://jetentityframeworkprovider.codeplex.com/
EDIT
Now the EF provider for Access is hosted on GitHub
https://github.com/bubibubi/JetEntityFrameworkProvider
I am currently writing a WCF data service that is meant to extract data from any database in a predefined standard structure.
I was thinking of using POCO entities. I can design my entities on EF designer and generate the POCO classes from it but the bit I struggling to understand is how to write data access layer and inject it into the DBContext.
So for each different database, I'll have a data access layer that will retrieve data from a database or even an xml file and map the data to my POCO entities.
I am not sure if this is achievable at all.
The POCO classes will be my standard structure to expose to the world.
I can't see anywhere to write custom sql queries to extract data from a DB and then set the data in the POCO classes. The POCO classes do not match any of the database tables so I explicitly need to map database fields to the POCO classes but I am not sure how to do this in Entity Framework using POCO.
I believe POCO is the write option but struggling on the data access layer and mappings from database to POCO classes.
All the samples I have seen talk about connecting the EF to an existing database directly. Meaning the EF structure has to match the structure of the database. What I want is a single EF/POCO structure that can retrieve data from multiple databases. These databases do not have the same structure but I need to manually retrieve data from these databases and transform it into the POCO classes structures. I do not necessarily want to get data from multiple databases at once but from a single DB but want to use the same model for any database - So I guess I have to write a custom DAL for each database which gets the data from a DB and transform the data into the POCO model structure.
I would really appreciate if anyone could help me.
By the way I am new to EF so please be patient.
Have you followed this tutorial which shows you how to create model classes from a DB and query against them?
Also here is a great tutorial on using EF code-first, in which you build your POCO classes first, and it generates the DB for you. Great read :).