hi friends,
I am getting problem while mapping my model class(with subclasses).
I am not getting the Name. It shows error while writing the code.
The error is "CatsTute' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'CatsTute' could be found (are you missing a using directive or an assembly reference?)":
Here is main model (CatsTutes):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using codes.Models.BaseModel;
namespace codes.Models
{
public class CatsTute:ModelBase
{
public class Category:ModelBase
{
public virtual string Name { get; set; }
public virtual string Image { get; set; }
}
public class SubCat:ModelBase
{
public virtual int CatId { get; set; }
public virtual string Name { get; set; }
public virtual string Image { get; set; }
}
public class Tutorial:ModelBase
{
public virtual string Name { get; set; }
public virtual string Description { get; set; }
public virtual int SubCatId { get; set; }
}
}
}
This is base model(ModelBase):-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace codes.Models.BaseModel
{
public class ModelBase
{
public virtual int Id { get; set; }
public virtual DateTime CreatedOn { get; set; }
public virtual DateTime UpdatedOn { get; set; }
public virtual int Deleted { get; set; }
public virtual bool Status { get; set; }
}
}
Here is mapping class(AllMapping):-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FluentNHibernate.Mapping;
namespace codes.Models.Mapping
{
public class AllMappings : ClassMap<CatsTute>
{
public AllMappings()
{
Table("CatsTute");
Id(x => x.Id, "Id").GeneratedBy.Identity().UnsavedValue(0);
Map(x => x.Status);
Map(x => x.CreatedOn);
Map(x => x.UpdatedOn);
Map(x => x.Deleted);
Map(x => x.Name).CustomSqlType("nvarchar(50)"); <========Here is the problem
DynamicUpdate();
}
}
}
What I have tried:
I don't know what to do............