MySql dialect is written in that form "MySQLDialect" not "MySqlDialect"
Also make sure that you have necessary mysql drivers dll in bin folder.

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Sun, Aug 9, 2009 at 4:00 AM, Alaor Carvalho Neto <[email protected]>wrote:

>
> Guyz, I'm a begginer with nhibernate, I downloaded it for the first
> time and then I was following the quick start tutorial but it was
> frustating that the first test didn't run! And I can't find what I did
> wrong, please help me!
>
> I changed only a few things from the quick start tutorial, first, I
> have a Usuario (User) class, not an Product, what is irrelevant And
> I'm using MySql. Dispite that I didn't change anything, my directory
> structure is like that:
>
> Uniflu
> -> Uniflu.Domain
> -> -> Properties
> -> -> References
> -> -> Mappings
> -> -> -> Usuario.hbm.xml
> -> -> hibernate.hbm.xml
> -> -> Usuario.cs
> -> Uniflu.Tests
> -> -> GenerateSchema_Fixture.cs
>
> my Usuario.cs class:
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
>
> namespace Uniflu.Domain
> {
>    public class Usuario
>    {
>        public virtual Guid Id { get; set; }
>        public virtual String Nome { get; set; }
>        public virtual String Email { get; set; }
>        public virtual String Senha { get; set; }
>        public virtual String Dica { get; set; }
>        public virtual DateTime DataCriado { get; set; }
>        public virtual DateTime UltimoAcesso { get; set; }
>        public virtual Boolean Ativo { get; set; }
>    }
> }
>
>
> My Usuario.hbm.xml (it IS set to embedded resource):
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>                   assembly="Uniflu.Domain"
>                   namespace="Uniflu.Domain">
>  <class name="Usuario">
>    <id name="Id">
>      <generator class="guid" />
>    </id>
>    <property name="Nome" />
>    <property name="Email" />
>    <property name="Senha" />
>    <property name="Dica" />
>    <property name="DataCriado" />
>    <property name="UltimoAcesso" />
>    <property name="Ativo" />
>  </class>
> </hibernate-mapping>
>
> My hibernate.cfg.xml (also set to embedded resource):
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
>  <session-factory>
>    <property
> name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</
> property>
>    <property
> name="connection.provider">NHibernate.Connection.DriverConnectionProvider</
> property>
>    <property name="dialect">NHibernate.Dialect.MySqlDialect</
> property>
>    <property
>
> name="connection.connection_string">Server=Athenas;Database=uniflu;Uid=alaor;Pwd=test;</
> property>
>    <property name="show_sql">true</property>
>  </session-factory>
> </hibernate-configuration>
>
> I get an error in the line cfg.AddAssembly(typeof(Usuario).Assembly)
> of my test, here is the error text:
>
> ------ Test started: Assembly: Uniflu.Domain.dll ------
>
> TestCase
> 'Uniflu.Domain.Tests.GenerateSchema_Fixture.Can_generate_schema'
> failed: NHibernate.MappingException : Could not compile the mapping
> document: Uniflu.Domain.Mappings.Usuario.hbm.xml
>  ----> NHibernate.HibernateException : Could not instantiate dialect
> class NHibernate.Dialect.MySqlDialect
>  ----> System.TypeLoadException : Could not load type
> NHibernate.Dialect.MySqlDialect. Possible cause: no assembly name
> specified.
>        em NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
>        em
> NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
> doc)
>        em NHibernate.Cfg.Configuration.ProcessMappingsQueue()
>        em NHibernate.Cfg.Configuration.AddInputStream(Stream
> xmlInputStream,
> String name)
>        em NHibernate.Cfg.Configuration.AddResource(String path, Assembly
> assembly)
>        em NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
>        em NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
>        em NHibernate.Cfg.Configuration.DoConfigure(IHibernateConfiguration
> hc)
>        E:\Projetos\Uniflu\Uniflu\Uniflu.Domain\Tests
> \GenerateSchema_Fixture.cs(15,0): em
> Uniflu.Domain.Tests.GenerateSchema_Fixture.Can_generate_schema()
>        --HibernateException
>        em NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName)
>        em NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props)
>        em
> NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument
> doc)
>        --TypeLoadException
>        em NHibernate.Util.ReflectHelper.TypeFromAssembly
> (AssemblyQualifiedTypeName name, Boolean throwOnError)
>        em NHibernate.Util.ReflectHelper.ClassForName(String name)
>        em NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName)
>
>
> 0 passed, 1 failed, 0 skipped, took 5,97 seconds (NUnit 2.5).
>
> Please help me guyz, I can't understand what I'm doing wrong!!!
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to