Page 1 of 1

Entity Developer generates code which does not compile

Posted: Tue 23 Mar 2010 14:09
by migle
Hi,

We have configured a given project to include all model classes in one namespace, and the DataContext class in another namespace.
This is an option in the "Project Properties" dialog box, "Model" tab, the two text boxes labeled "Context Namespace" and "Entity Namespace".

This has suited us better, so far, because we keep these in separate projects, because they have different dependencies (specifically, the model classes do not depend on dotConnect classes and the DataContext does).

However, when we recently added some methods (stored procedures) to the mapping which use model types as arguments or return values, we came across this issue: the methods declarations in the DataContext class use namespace unqualified names for their arguments and return type.

Because the entity types are in a different namespace, this code does not compile.

For instance, if stored procedure "getEntity" on the database receives an int as argument and returns type "Entity", the generated function will be:

Code: Select all

        [Function(Name=@"getEntity", IsComposable=true)]
        public System.Linq.IQueryable GetEntity([Parameter(Name="$1", DbType="int4")] System.Nullable i)
        {
            return this.CreateMethodCallQuery(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), i);
        }
Which won't compile because Entity is not declared within the DataContext namespace.

Right?

Posted: Thu 25 Mar 2010 15:04
by AndreyR
Thank you for the report, I have reproduced the problem.
I will let you know as soon as it is fixed.

Posted: Mon 29 Mar 2010 07:58
by AndreyR
We have fixed the error. Look forward to the nearest build.