I am using .net 2005 and sql server 2005 and llbl pro 2.0
Through LLBL Pro I am fetching data from three tables and putting into in collection.Then I am trying to bind these data
to grid by using EntityProjection. In collection, correct value is showing for every field. But after binding
wrong data is showing in grid.
In database one-to-one relation is there between Contact table and SponsorContact table . Again Between sponsorContact and SponsorAffiliateContact one-to-one relation is there. Between contact and ContactPhone one-to-many realtion is there ,between contact and office many-to-one relation is there.
What is the solution for that?
Here is my code:
EntityCollection<SponsorAffiliateContactEntity> sponsorContact = new
EntityCollection<SponsorAffiliateContactEntity>();
IPrefetchPath2 prefetchForContact = new PrefetchPath2((int)EntityType.SponsorAffiliateContactEntity);
prefetchForContact.Add(SponsorAffiliateContactEntity.PrefetchPathContactPhone);
prefetchForContact.Add(SponsorAffiliateContactEntity.PrefetchPathOffice);
adapterForCommon = new DataAccessAdapter();
adapterForCommon.FetchEntityCollection(sponsorContact, null, prefetchForContact);
if (sponsorContact.Count > 0)
{
//Using LLBLProjection's get the data into datatable
DataTable dtsponsorContact = new DataTable();
List<IEntityPropertyProjector> propertyProjectors = new List<IEntityPropertyProjector>();
propertyProjectors.Add(new EntityPropertyProjector(ContactFields.ContactId, "ContactId"));
propertyProjectors.Add(new EntityPropertyProjector(ContactFields.LastName, "LastName"));
propertyProjectors.Add(new EntityPropertyProjector(ContactFields.FirstName, "FirstName"));
propertyProjectors.Add(new EntityPropertyProjector(ContactFields.Title, "Title"));
propertyProjectors.Add(new EntityPropertyProjector(ContactFields.Department, "Department"));
propertyProjectors.Add(new EntityPropertyProjector(ContactFields.PrimaryEmail, "PrimaryEmail"));
propertyProjectors.Add(new EntityPropertyProjector(OfficeFields.Name, "Office"));
propertyProjectors.Add(new EntityPropertyProjector(ContactPhoneFields.AreaCode, "AreaCode"));
propertyProjectors.Add(new EntityPropertyProjector(ContactPhoneFields.Number, "Number"));
propertyProjectors.Add(new EntityPropertyProjector(ContactPhoneFields.Extension, "Extension"));
propertyProjectors.Add(new EntityPropertyProjector(SponsorAffiliateContactFields.Company, "Affiliate"));
propertyProjectors.Add(new EntityPropertyProjector(SponsorContactFields.EnableLogin, "EnableLogin"));
sponsorContact.DefaultView.CreateProjection(propertyProjectors, dtsponsorContact);
mngSponsorContactGrid.DataSource = dtsponsorContact;
mngSponsorContactGrid.DataBind();
Office,AreaCode,Number,Extension fields are showing wrong values.