0

When I use the EntityFramework.Extended in my RiceBuySellProvider project, I got this error in my main project:

The type or namespace name I remove the 'RiceBuySellProvider' could not be found (are you missing a using directive or an assembly reference?)

From MainProject Image enter image description here

But when I remove the .FutureFirstOrDefault() of EntityFramework.Extended from my RiceBuySellProvider and no errors found. Why?

UPDATE

When I use the .FutureFirstOrDefault() this will be the cause of the error.

public static ProductEntity GetProduct(string productNo)
{
    using (var con = new RiceBuySellEntities(ConnectionStr))
        return CompiledQueries.GetProCatTypeUnit.Invoke(con, productNo).FutureFirstOrDefault();
}
spajce
  • 7,044
  • 5
  • 29
  • 44

1 Answers1

1

You need to add a reference to the assembly that holds the namespace you are importing.

Project Properties > Refernces

Edit
Its possible that the Rice assembly targets an incompatible framework, or that its bittyness (x86 / x64) is mismatched.

Sam Axe
  • 33,313
  • 9
  • 55
  • 89
  • yes, of course we need to reference our `.dll`. but please try to figure out my question `:)` – spajce Feb 06 '13 at 03:21
  • No. YOU figure out your question and ask what you mean. It's not my job to play psychic. – Sam Axe Feb 06 '13 at 03:23
  • okay. thats fine, obviously, the `RiceBuySellProvider` is already in my main project. thats why i wonder i got this error `:D` – spajce Feb 06 '13 at 03:24
  • +1 it might be. but this is strange. why this error occurred when I use the `.FutureFirstOrDefault()` of `EntityFramework.Extended` – spajce Feb 06 '13 at 06:54
  • The error indicates that the assembly has not loaded. Any method on any class from the assembly will fail. – Sam Axe Feb 06 '13 at 06:58
  • you have a point, but this is not might be the error because I downloaded the `EntityFramework.Extended` using the `Nuget` so I expect that the `.dll` have no errors. – spajce Feb 06 '13 at 07:02
  • 1
    You're probably right. There is most likely an incompatibility between the dll and your project. – Sam Axe Feb 06 '13 at 07:55