.NET MVC 3, autogenerate/mapping model schema into Mysql? - mysql

I'm new to .net mvc 3. I was using PHP Symfony previously.
In this tutorial from the official website, the author used .sdf as example.
http://beta.asp.net/mvc/tutorials/getting-started-with-mvc3/getting-started-with-mvc3-part4-cs
The schema in .sdf was autogenerated according to the Model class file.
My question, is it possible to do the same thing using Mysql?
Thanks :)

This should work (have never used ef code first with mySql) as long as you have the .net connector for MySql.
You can grab it here: http://dev.mysql.com/downloads/connector/net/
You can also try this alternative connector from DevArt: http://www.devart.com/dotconnect/mysql/
* EDIT *
It seems that the DevArt connector will do the trick.

Related

Yii2 - Generating CRUD from all models

After creating all database tables in MySQL or MariaDB, I am able to generate all Yii2 Models using gii by simple entering * and voila, all models are created.
My question; I was wondering if there's an equivalent way of generating all CRUD - at once - based on generated models in a similar way, either from the console with a one-liner or from the browser with the gii CRUD Generator.
Answer:
Not using standard "yiisoft/yii2-gii" unfortunately. You can compare the "generate()" functions for the model and crud to get a programmatic reason here:
Model: https://github.com/yiisoft/yii2-gii/blob/master/src/generators/model/Generator.php
CRUD: https://github.com/yiisoft/yii2-gii/blob/master/src/generators/crud/Generator.php
Solution:
You can use "schmunk42/yii2-giiant" which looks to do what you require and has decent decent support. Found here: https://github.com/schmunk42/yii2-giiant
"mootensai/yii2-enhanced-gii" is another option but was last updated August 2017. Found here: https://github.com/mootensai/yii2-enhanced-gii
I hope these help.

replace codeigniter 's active record in nodejs

Is there an equivalent for Codeigniter's implementation of active record in NodeJS somewhere?
I am well aware of the basic mysql connector, however all the security/convenience features that a newbie such as myself relies on to not end up in catastrophe don't appear to be there - it looks like just talking raw SQL to the database driver.
Take a look at Tower project.It is a node based project with very minimal dependencies
Or you can also look at MySQL ActiveRecord Adapter for Node.js
Check JugglingDB - cross-db ORM for nodejs

mysql.data conflict something in my entity framework project

I'm using MySQL database in my Ado.Net project. So I am using entity framework model first. It is good but when i want to add "mysql.data" (which i get from mysql web site named mysql data connector) to the Referances, it gives me an error like this: "object reference not set to an instance of an object". When i remove mysql.data from Referances, it works good. I think, it may cause mysq.data. I want to use mysql.data for searching queries. Because i don't know to code searching queries entity framework in my mysql ado.net project.
Could you help me, how do I solve the problem? I want to use both mysql.data and entity framework model first in my project.
Sincerely yours.
Now, I solved the problem. I provided "mysql.data.entity.dll" from MySQL web site, I added to referances and now everything is good.

Any better way to use Oracle/MySQL with .NET Entity Framework?

I wonder the simplicity of working with Microsoft SQL database server with .NET Entity Framework. Is there a possible way to use it with Oracle & MySQL database servers?
You could use another ORM, like NHibernate which supports Microsoft SQL, Oracle, and MySQL, among many others.
If you want/need to stick with EF, there are already questions on SO about using it with MySQL and with Oracle.
Oracle Data Access Components for .NET (http://www.oracle.com/technetwork/topics/dotnet/downloads/oracleefbeta-302521.html) includes also Oracle Data Provider for .NET 4 11.2.0.2.40.
A nice tutorial how to use Model-First approach can be found at http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/EntityFrameworkOBE/EntityFrameworkOBE.htm.
Good luck,
LM
A list of Oracle providers for Entity Framework can be found here:
Comparison of Entity Framework compatible providers for Oracle?
And for MySQL these are available:
http://www.mysql.com/products/connector/
http://www.devart.com/dotconnect/entityframework.html
http://uda.openlinksw.com/dotnet/

grails/gorm/mysql/hibernate

I have a simples question. I have been trying to learn Grails by my own, and i managed to do a simple application using Grails/Gorm.
1 ) Later, i decided to use Mysql instead of Gorm - i just needed to configure the 'DataSource' and download the driver.
2 )So if i want to use hibernate between both (Grails and MYSQL) like this:
http://www.grails.org/doc/latest/guide/15.%20Grails%20and%20Hibernate.html, i need to make an 'hibernate.cfg.xml' file, and specify my mysql database url, user, pw etc .. and i have to map each Class in Grails for MySql columns.
So what is the diference between 1) and 2) ? and what exactly hibernate does. Give examples if possible
PS. Please correct me if i said something wrong, im kinda new to this
I think you are a bit confused here.
GORM is not a database, it is a ORM that maps you Groovy classes to database tables. It uses Hibernate under the covers to achieve this (Hibernate is also an ORM).
The default database Grails uses is an in-memory HSQL DB. If you want to use MySQL instead of that, all you need to do is change the settings in conf/DataSource.groovy.
You don't need to create any Hibernate xml files. That part of the documentation you've linked to is to allow people with existing Hibernate domain models to easily re-use them.
Hope this helps clear things up.
cheers
Lee