J'espère qu'il y a une explication très simple pourquoi je reçois cette erreur. J'utilise S # arpArcitecture 1.6. sur une installation Windows 64 64 bits.Expected System.String, a obtenu System.Guid
ligne 3 du code ci-dessous donne l'erreur:
{ "id fourni du mauvais type attendu. System.String, a System.Guid"} {System.Exception NHibernate.TypeMismatchException}
1 public Category GetCategory(Guid id)
2 {
3 Category cat = categoryRepository.Get(id);
4 return cat;
5 }
soutien Infos
Table (SQL Server 2008)
CREATE TABLE [dbo].[MasterCategories] (
[masterCategoryId] [uniqueidentifier] ROWGUIDCOL NOT NULL,
[organizationId] [nchar](5) NOT NULL,
[categoryNumber] [nvarchar](25) NOT NULL
)
Entité Définition
public class Category : EntityWithTypedId<Guid>
Mapping Courant
public void Override(AutoMapping<Category> mapping)
{
mapping.Table("MasterCategories");
mapping.Id(x => x.Id).Column("masterCategoryId");
mapping.Map(x => x.Number).Column("categoryNumber");
mapping.References(x => x.Organization)
.Column("organizationId")
.Cascade.All();
}
Interface Repository
public interface ICategoryRepository : IRepositoryWithTypedId<Category,Guid>
{
}
dépôt
public class CategoryRepository :
RepositoryWithTypedId<Category,Guid>,
ICategoryRepository
{ }
Pouvez-vous obtenir le xml généré par Fluent? –