This question is locked. New answers and comments are not allowed.
I'm having trouble to map my table.
The following error message is showing, every time.
The metadata for field 'lado' of class 'NewCastle.Modelo.Celulas.Celula' cannot be initialized: No database type mapping found for field 'lado': CLR type 'NewCastle.Modelo.Lado' or column type '' unmapped.
Table (attached).
Class Celula:
Struct Lado:
Mapping (only Celula's block):
The question is, how i have to map fields who aren't primitive objects (and who are prepared to get primitive values, and automatically convert to field type) in domain and in database they are?
Database = char
Domain = Lado (struct)
The following error message is showing, every time.
The metadata for field 'lado' of class 'NewCastle.Modelo.Celulas.Celula' cannot be initialized: No database type mapping found for field 'lado': CLR type 'NewCastle.Modelo.Lado' or column type '' unmapped.
Table (attached).
Class Celula:
public sealed class Celula
{
internal Celula() { }
public string pk_Celula { get; private set; }
public short Corredor { get; set; }
public short Ala { get; set; }
public short Andar { get; set; }
public Lado Lado { get; set; }
public Profundidade Profundidade { get; set; }
public Situacao Situacao { get; set; }
}Struct Lado:
public struct Lado
{
public static readonly IDictionary<int, Lado> Lista = new Dictionary<int, Lado>();
public static readonly Lado Direito = new Lado(20, "Direito", "D");
public static readonly Lado Esquerdo = new Lado(10, "Esquerdo", "E");
private readonly int _Valor;
private readonly string _Nome;
private readonly string _nomeCurto;
public Lado(int valor, string nome, string nomeCurto)
{
this._Valor = valor;
this._Nome = nome;
this._nomeCurto = nomeCurto;
Lista.Add(this._Valor, this);
}
static public implicit operator char(Lado lado)...
static public implicit operator Lado(char lado)...
public string nomeCurto()
{
return this._nomeCurto;
}
public override string ToString()
{
return this._Nome;
}
}Mapping (only Celula's block):
MappingConfiguration<Celula> celulaConfiguration = new MappingConfiguration<Celula>(); celulaConfiguration.MapType(p => new { pk_Celula = p.pk_Celula, Corredor = p.Corredor, Ala = p.Ala, Andar = p.Andar, Lado = p.Lado, Profundidade = p.Profundidade, Situacao = p.Situacao }).ToTable(this.obterNome("Celulas")); celulaConfiguration.HasProperty(p => p.pk_Celula).IsIdentity(); celulaConfiguration.HasArtificialPrimitiveProperty<char>("Lado"); configurations.Add(celulaConfiguration);The question is, how i have to map fields who aren't primitive objects (and who are prepared to get primitive values, and automatically convert to field type) in domain and in database they are?
Database = char
Domain = Lado (struct)