I just added a column to the table that the Entity Framework displayed. The Entity structure added a column to the model, but does not include the column in which it selects queries. This is the class that generates EF:
public partial class mj_bagasse_gc_sampledetail
{
public long ID { get; set; }
public Nullable<double> FructoseArea { get; set; }
public Nullable<double> SucroseArea { get; set; }
public Nullable<double> GlucoseArea { get; set; }
public Nullable<double> TrehaloseArea { get; set; }
public Nullable<double> SampleWeight { get; set; }
public Nullable<double> TrehaloseWeight { get; set; }
public string TriplicateIndex { get; set; }
public Nullable<long> Sample_ID { get; set; }
public Nullable<double> FructoseConc { get; set; }
public Nullable<double> SucroseConc { get; set; }
public Nullable<double> GlucoseConc { get; set; }
public Nullable<int> GCIndex { get; set; }
public string BottleNo { get; set; }
public Nullable<bool> SelectedSampleDetail { get; set; }
public Nullable<int> SampleDetailRun { get; set; }
public virtual global_global_sample global_global_sample { get; set; }
}
this is the XML to display in the EDMX file:
<EntityType Name="mj-bagasse_gc_sampledetail">
<Key>
<PropertyRef Name="ID" />
</Key>
<Property Name="ID" Type="bigint" Nullable="false" StoreGeneratedPattern="Identity" />
<Property Name="FructoseArea" Type="float" />
<Property Name="SucroseArea" Type="float" />
<Property Name="GlucoseArea" Type="float" />
<Property Name="TrehaloseArea" Type="float" />
<Property Name="SampleWeight" Type="float" />
<Property Name="TrehaloseWeight" Type="float" />
<Property Name="TriplicateIndex" Type="varchar" MaxLength="2" />
<Property Name="Sample_ID" Type="bigint" />
<Property Name="FructoseConc" Type="float" />
<Property Name="SucroseConc" Type="float" />
<Property Name="GlucoseConc" Type="float" />
<Property Name="GCIndex" Type="int" />
<Property Name="BottleNo" Type="varchar" MaxLength="20" />
<Property Name="SelectedSampleDetail" Type="bit" />
<Property Name="SampleDetailRun" Type="int" />
</EntityType>
In both cases, you will clearly notice that the "SampleDetailRun" column is correctly defined. However, when I try to get a row from a table using the LINQ statement:
(from sd in Entities.mj_bagasse_gc_sampledetail
where (sd.Sample_ID == Sample.ID) &&
(sd.TriplicateIndex == s) select sd).FirstOrDefault();
This SQL statement is executed:
exec sp_executesql N'SELECT TOP (1)
[Extent1].[ID] AS [ID],
[Extent1].[FructoseArea] AS [FructoseArea],
[Extent1].[SucroseArea] AS [SucroseArea],
[Extent1].[GlucoseArea] AS [GlucoseArea],
[Extent1].[TrehaloseArea] AS [TrehaloseArea],
[Extent1].[SampleWeight] AS [SampleWeight],
[Extent1].[TrehaloseWeight] AS [TrehaloseWeight],
[Extent1].[TriplicateIndex] AS [TriplicateIndex],
[Extent1].[Sample_ID] AS [Sample_ID],
[Extent1].[FructoseConc] AS [FructoseConc],
[Extent1].[SucroseConc] AS [SucroseConc],
[Extent1].[GlucoseConc] AS [GlucoseConc],
[Extent1].[GCIndex] AS [GCIndex],
[Extent1].[BottleNo] AS [BottleNo]
FROM [dbo].[mj-bagasse_gc_sampledetail] AS [Extent1]
WHERE ([Extent1].[Sample_ID] = @p__linq__0) AND ([Extent1].[TriplicateIndex] = @p__linq__1)',N'@p__linq__0 bigint,@p__linq__1 varchar(8000)',@p__linq__0=127,@p__linq__1='A'
go
select SampleDetailRun, , . . ( ), EF select.
EF5
?