views:

505

answers:

1

In my partial class which defines a function which returns the type of IMultipleResults to bring back multiple result shapes from a stored procedure using the classes defined in my *.dbml file, for some reason the [ResultType(typeof(MyType))] isn't working. The MyType is saying that it cannot be found. The function is in the .cs file of my .dbml file, and the type is definitely in my dbml file.

Any ideas on why it can't find it? Here's an idea:

using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Reflection;

namespace IntranetMvcAreas
{
  partial class ContractsControlDataContext : DataContext
  {
    [Function(Name = "dbo.procCC_Contract_Select")]
    [ResultType(typeof(Contract))]
    [ResultType(typeof(ContractCostCentre))]
    [ResultType(typeof(tblCC_Contract_Data_Terminal))]
    [ResultType(typeof(tblCC_CDT_Data_Service))]
    [ResultType(typeof(tblCC_Data_Service))]
    public IMultipleResults procCC_Contract_Select(
        [Parameter(Name = "ContractID", DbType = "Int")] System.Nullable<int> ContractID,
        [Parameter(Name = "ResponsibilityKey", DbType = "Int")] System.Nullable<int> ResponsibilityKey,
        [Parameter(Name = "ExpenseType", DbType = "Char")] System.Nullable<char> ExpenseType,
        [Parameter(Name = "SupplierID", DbType = "Int")] System.Nullable<int> SupplierID)
    {
      IExecuteResult result = this.ExecuteMethodCall(this, (MethodInfo)(MethodInfo.GetCurrentMethod()), ContractID, ResponsibilityKey, ExpenseType, SupplierID);
      return (IMultipleResults)result.ReturnValue;
    }
  }
}

All types in typeof cannot be found, despite being in dbml file.

+1  A: 

Spoke way too soon, Intellisense finally picked up. You have to include the relative using statement against your project. (I've never seen this anywhere), so using IntranetMvcAreas.Areas.Accounts.Models; did the trick.

Kezzer