This is for CSLA 4.01:
I have implemented a custom identity class that inherits from CslaIdentity. I have the data access portions working in embedded DataPortal_Fetch methods inside my custom class. The rest of my app business objects all use data access code located in Object Factory classes. I'm a bit stuck on how to migrate my identity class DataPortal_Fetch method to an object factory method. Specifically, I'm able to populate all of my custom identity properties throught the setproperty methods, but I can't figure out how to access the protected IIdentity properties that are implemented in the CslaIdentity base class (AuthenticationType, IsAuthenticated and the Name properties.)
Can anyone give me any hints on how I should do this? All the samples I've found either use the DataPortal_Fetch code or if they implement an object factory they're not inheriting from CslaIdentity with it's protected properties.
Implement a simple Fetch method like this in yoy custom identity class:
public void Fetch(string userName, IEnumerable<string> roles)
if (userName != null)
Name = userName;
IsAuthenticated = true;
var roleList = new MobileList<string>();
foreach (var role in roles)
Roles = roleList;
Name = "";
IsAuthenticated = false;
Roles = new MobileList<string>();
and call this method with data loaded from in your factory class.
If you want to "hide" this method you could make it Internal and use the InternalsVisibleTo attribute to make it visible only to you ObjectFactory assembly.
Thanks Jonny, that was exactly what I needed!!!
Copyright (c) Marimer LLC