ActiveRecord 映射:
[ActiveRecord("JobTitle",Schema="public")]
public class JobTitle :ActiveRecordValidationBase<JobTitle>
{
[PrimaryKey(Column = "Id")]
public virtual int Id { get; set; }
[Property(Column = "Description")]
public virtual string Description { get; set; }
[Property(Column = "Title", NotNull = true)]
public virtual string Title { get; set; }
}
数据库连接:
数据库配置:
public class DbConfig
{
public static void Configure()
{
var connectionString=ConfigurationManager.ConnectionStrings["PgConnection"].ConnectionString;
var source = ActiveRecordSectionHandler.Build(DatabaseType.PostgreSQL82,connectionString);
ActiveRecordStarter.Initialize(source, typeof(JobTitle));
}
}
并在应用程序上初始化:
测试例如表:
//
// GET: /Home/
public string Index()
{
var jobTitle= JobTitle.TryFind(1);
return jobTitle.Title;
}
获取活动记录时出错:
跟踪是:
我知道请求是错误的。因为错误地发送到 pg sql 查询。这个对我的“JobTitle”表的简单查询:
select * from public.jobtitle => Castle Active Record
select * from public."jobtitle" => Pg
我该如何解决这个铸造问题?