I have a working project, but when I try to insert a new column into a view in entity framework as follows : The Mapper class of view contains :
namespace DBRefresh.Models.Mapping
{
public class v_Report_HIVE_Roadmap_AnalyticsMap : EntityTypeConfiguration<v_Report_HIVE_Roadmap_Analytics>
{
public v_Report_HIVE_Roadmap_AnalyticsMap()
{
// Primary Key
this.HasKey(t => new { t.Solution_ID_and_Name, t.Viz_Status, t.t_f, t.Updated_MR,
t.Governance_Team, t.Tied_to_a_Heavyweight_Solution, t.Solution_Type, t.Is_Dup_,t.ROW_NUM });
this.Property(t => t.ROW_NUM).IsRequired();
//other properties defined
//table column and mapping
this.Property(t => t.ROW_NUM).HasColumnName("ROW_NUM");
}
}
}
The Model Class has the following:
namespace DBRefresh.Models
{
public partial class v_Report_HIVE_Roadmap_Analytics
{
public long Row_NUM{ get; set; }
}
}
I get a Null Pointer exception when I try to read data from the db. The data is read through various controllers so cannot directly write here, but they all work fine until I add this new column. On adding this column which I have made as a primary key in my view, I get the null pointer exception on the very first table that my application reads.
Database structure for the view is :
SELECT *, ISNULL(ROW_NUMBER() OVER(ORDER BY Industry),-1) as ROW_NUM
FROM (
Select ....)
The view contains this column as ROW_NUM(bigint,not null)
Trying to figure out the cause for days, Any help would be appreciated.
Go to the model folder select the model
> right click
> select update model from database
> refresh > finish
I hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.