Thanks a lot Silvio to provide time to assist me,
Actually I did not mention the fact that in my sample I made a derivation of entity to produce the problem. At first, I thought it was not important to mention but I must be wrong.
I made changes to the model so that to get a derived entity as shown in the picture at the end of this post.
Anyway, this is the sample I have been using:
static void Main(string[] args)
{
NorthwindIBEntities manager = new NorthwindIBEntities(
shouldConnect: true,
dataSourceExtension: String.Empty,
entityServiceOption: IbEm.EntityServiceOption.UseLocalService,
compositionContextName: String.Empty);
IbEm.EntityQuery<Employee> employees = manager.GetQuery<Employee>();
IbEm.EntityQuery<Group> groups = manager.GetQuery<Group>();
Group u2 = groups.Where<Group>(gr => gr.Name == "U2").First<Group>();
employees = employees.Where(e => e.Group.Name == "U2") as IbEm.EntityQuery<Employee>;
Int32 employeeCount = employees.AsEnumerable<Employee>().Count();
Employee newEmployee = new Employee();
newEmployee.EmployeeID = 11;
newEmployee.LastName = "Hewson";
newEmployee.FirstName = "Paul David";
newEmployee.Title = "Sales Representative";
newEmployee.TitleOfCourtesy = "Mr.";
newEmployee.BirthDate = new DateTime(1960, 5, 10);
newEmployee.HireDate = new DateTime(2011, 9, 7);
newEmployee.Address = "Sunset Boulevard";
newEmployee.City = "Hollywood";
newEmployee.Region = "CA";
newEmployee.PostalCode = "22222";
newEmployee.Country = "USA";
newEmployee.HomePhone = "(222) 222-2222";
newEmployee.Extension = "222";
newEmployee.Notes = "Former singer of U2";
newEmployee.PhotoPath = "http://en.wikipedia.org/wiki/File:Bono_at_the_2009_Tribeca_Film_Festival.jpg";
newEmployee.ReportsToEmployeeID = 2;
newEmployee.RowVersion = 0;
newEmployee.Group = u2;
manager.AddEntity(newEmployee);
Int32 newEmployeeCount = employees.AsEnumerable<Employee>().Count();
}
I can provide you with the exact code sample + the mdf file in the next post.
As a final note these are the modifications I made to the NorthwindIB model:
Thanks again for your dedication and time.
Frederic