1

I am using a dataset from LINQ and thus as in LINQ the linked tables are represented as well although I am unable to access their fields only the foreignkey.value I am unable to drill into the object fields like a normal LINQ .

Does anyone know if this is possible.

Example

It seems that I did not explain enough so let me try to better explain. I have a class STranline (Stock Tranline) one of the fields that is available is Stock (another class) although when in the report designer Stock is available , I have no option to see what fields are available in stock.Such as Stock.StkCode or Stock.StkDesc these are some examples which will hopefully clarify what I am trying to do if it is actually possible in the first place.

Enzero
  • 1,141
  • 2
  • 17
  • 36

3 Answers3

1

I found the solution as to why I am getting a error on nested objects at wraithnath

The solution shows that all objects must be serializable.

Enzero
  • 1,141
  • 2
  • 17
  • 36
0

You need to use AsEnumerable extension method to access rows. See this post. Also see MSDN page for reference.

Community
  • 1
  • 1
Junaid
  • 1,708
  • 16
  • 25
0

I found an efficient solution for this issue.

If you have a report with lots of info then using Serializable for all the classes and subclasses will make the rendering process too slow.

As an alternative to using Serializable:

Just make a partial class of your base class and make a new string property with the nested property you want to show and cast the properties to a string if different.

For example:

public partial class STranline
{
    public string StockCode => Stock.StkCode;
    public string StockDescription => Stock.StkDesc;
}