PhantomDb MVC es una extensión que permite poder configurar y utilizar PDB en ASP.NET y ASP.NET MVC de una manera sencilla. Incluye un ejemplo en el que se integran las DLL nombradas anteriormente. Requiere .NET Framework 4.0.
Para realizar la configuración, se deben realizar dos pasos:
Dentro de Web.config agregar:
En configSections:
<section name="Phantom" type="PhantomDb.MVC.Configuration.Phantom, PhantomDb.MVC" />
Luego agregar la sección:
<Phantom>
<Schemas>
<Schema
name=<Nombre del esquema>
connection=<String connection>
context=<Referencia al contexto>
handler=<Referencia al manejador>
/>
</Schemas>
</Phantom>
Ejemplo de configuración para MySQL:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="Phantom" type="PhantomDb.MVC.Configuration.Phantom, PhantomDb.MVC" />
...
</configSections>
...
<Phantom>
<Schemas>
<Schema
name="mysql"
connection="Server=127.0.0.1;Database=testdb;Uid=root;Pwd=;"
context="PhantomDb.Mysql.MysqlContext, PhantomDb.Mysql"
handler="PhantomDb.Mysql.MysqlHandler, PhantomDb.Mysql"
/>
</Schemas>
</Phantom>
</configuration>
Ejecutar en la clase Global, dentro de Application_Start:
PhantomDb.MVC.PhantomConfigurator.Configure();