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);
}
Right?