none
Linq partial class properties not available in Reporting Services data source RRS feed

  • Question

  • Hi,

     

    I've created some LINQ data classes with the VS2k8 O/R designer. I've extended these classes with properties using the partial class mechanism. These properties are all available in datasources for GridViews, Dropdownlist, etc. But these properties are not available when I use them as a datasource for a Reporting Services report or Crystal report. Does anyone knows why and what I must do to make them available for my reports?

     

    Many thanx!

    Friday, June 6, 2008 1:52 PM

All replies

  • I can't see any reason why, did you check if there is a namespace mismatch between partial classes of one class and correct and see if that helps? if not, should you post some code to see whats happening, that would be great.

     

    Friday, June 6, 2008 7:12 PM
  • Hi,

    Thanks for your reply, here is the code you've requested:

    Code Snippet

    ' O/R Designer generated Department Class
    <Table(Name:="dbo.tbl_departments")>  _
    Partial Public Class Department
     Implements System.ComponentModel.INotifyPropertyChanging, System.ComponentModel.INotifyPropertyChanged
     
     Private Shared emptyChangingEventArgs As PropertyChangingEventArgs = New PropertyChangingEventArgs(String.Empty)
     
     Private _DepartmentID As Integer
     
     Private _Name As String
     
     
        #Region "Extensibility Method Definitions"
        Partial Private Sub OnLoaded()
        End Sub
        Partial Private Sub OnValidate(action As System.Data.Linq.ChangeAction)
        End Sub
        Partial Private Sub OnCreated()
        End Sub
        Partial Private Sub OnDepartmentIDChanging(value As Integer)
        End Sub
        Partial Private Sub OnDepartmentIDChanged()
        End Sub
        Partial Private Sub OnNameChanging(value As String)
        End Sub
        Partial Private Sub OnNameChanged()
        End Sub
        #End Region
     
     Public Sub New()
      MyBase.New
      Me._CaseActivities = New EntitySet(Of CaseActivity)(AddressOf Me.attach_CaseActivities, AddressOf Me.detach_CaseActivities)
      Me._Country = CType(Nothing, EntityRef(Of Country))
      Me._tbl_role = CType(Nothing, EntityRef(Of tbl_role))
      OnCreated
     End Sub
     
     <Column(Storage:="_DepartmentID", AutoSync:=AutoSync.OnInsert, DbType:="Int NOT NULL IDENTITY", IsPrimaryKey:=true, IsDbGenerated:=true)>  _
     Public Property DepartmentID() As Integer
      Get
       Return Me._DepartmentID
      End Get
      Set
       If ((Me._DepartmentID = value)  _
          = false) Then
        Me.OnDepartmentIDChanging(value)
        Me.SendPropertyChanging
        Me._DepartmentID = value
        Me.SendPropertyChanged("DepartmentID")
        Me.OnDepartmentIDChanged
       End If
      End Set
     End Property
     
     <Column(Storage:="_Name", DbType:="NVarChar(50) NOT NULL", CanBeNull:=false)>  _
     Public Property Name() As String
      Get
       Return Me._Name
      End Get
      Set
       If (String.Equals(Me._Name, value) = false) Then
        Me.OnNameChanging(value)
        Me.SendPropertyChanging
        Me._Name = value
        Me.SendPropertyChanged("Name")
        Me.OnNameChanged
       End If
      End Set
     End Property
    End Class

     

     


    ' Self created partial class with extended properties and methods
    Partial Public Class Department

        Public Overrides Function ToString() As String
            Return Name

        End Function

        Public ReadOnly Property ExtendedProperty() As String
            Get
                Return "This is an extended property"
            End Get
        End Property
    End Class

     

     

    Now, when using the Department class as ObjectDatasource in Reporting Services (local mode) the only properties available are DepartmentID and Name. The ExtendedProperty property is not available within Reporting Services. It looks like that only properties extracted from the database are available within Reporting Services.

     

    Raphael

    Monday, June 9, 2008 8:55 AM