using LLBLGEN 3.0 Entity Framework 4, SQL Server 2008
- We are having an issue with entity set pluralization.
In the edmx / context file, Conceptual model entity set names are not plurlaized. LLBL desginer generates following code in the context file for Employee Entity.
public ObjectSet<Employee> Employees
{
get { return _employee ?? (_employee = this.CreateObjectSet<Employee>("Employee")); }
}
When we try to reflect on Object Context to get the entityset name and add the object to the context
var entitySetProperty =
DbContext.GetType().GetProperties()
.Single(p => p.PropertyType.IsGenericType && typeof(IQueryable<>)
.MakeGenericType(typeof(TEntity)).IsAssignableFrom(p.PropertyType));
EntitySetName = entitySetProperty.Name;
DbContext.AddObject(EntitySetName, entity);
AddObject method fails here with below error
{System.InvalidOperationException: The EntitySet name '<ContainerName>.Employees' could not be found. at System.Data.Objects.ObjectContext.GetEntitySet(String entitySetName, String entityContainerName)
Issue here is generated Property Name(Employees) and EntitySetName(Employee) are different
In VS Studio Entity Framework designer, it will plurlaize the entity names so the above code will be generated like this
public ObjectSet<Employee> Employees
{
get { return _employee ?? (_employee = this.CreateObjectSet<Employee>("Employees")); }
}
How to control the Pluralization of EntitySet names (EDMX file and ObjectContext) from LLBL designer??
2.Another issue we have is whenever we add a stored procedure to our Entity model, LLBL code genetaor adds following line to EDMX file under StorageModels
<EntitySet Name="StoreProcedureName" EntityType="Self.StoreProcedureName" Schema="dbo" />
There is no entity type defined for stored procedure.This ends up in compilation error.
In VS Studio Entity Framework designer, stored procedures are not added to EntitySet.