We have begun using a great control called Pivotviewer. We see this as a control that can be used in many situations. http://www.silverlight.net/learn/pivotviewer/
We use Silverlight DevForce, with a login manager, in a PRISM environment.
One of the challenges we encountered was that we had to develop some HttpHelpers that generate just-in-time collections to the Pivotviewer The Pivotviewer loads the collection from a .cxml file which is given by an url. The file does not exist in our case so the HttpHelper generates it on-the-fly and returns the collection. This code runs server side and so we had problems creating an Entity manager server side:
var m_entityManager = new C2NetDomainModelEntityManager();
Reason is that the login manager lacks credentials – a user is logged in client side thou.
Our workaround was to add some code to the login manager. We put the logged in userId in the Tag property on the default manager when a user logs in:
EntityManager.DefaultManager.Tag = user.p_userID; // so I can see how is logged in later.
On our server, when generating the collection, we use the default manager. But this does not give us our EntityModel – so we have to type cast everything:
var m_entityManager = EntityManager.DefaultManager;
var query = new EntityQuery<EntImage>()
.Include("p_imageAlbums")
.Include("p_imageAlbums.p_imageAlbumType");
query.QueryStrategy = new QueryStrategy(FetchStrategy.DataSourceOnly, MergeStrategy.OverwriteChanges);
var images = m_entityManager.ExecuteQuery<EntImage>(query);
And then we use the Tag property of the default manager to do some access management:
if (album.p_usersWithAccess.Where(user => user.p_userID == (string) m_entityManager.Tag).Count() > 0)
hasAccessToImage = true;
Is this the right way doing it, when working server side?
Or is there a better way?