The member needs to be this complicated as it is used in a calculation engine. Due to the complexity I have written tests around the logic and this means I have a safety net to ensure the calculation is correct.
There are a few things I am struggling with:
1. How best to tie my MyComplexMember to umbraco, I have read the following article but it only deals with simple objects (i.e. strings) and I need to know how to handle generic Lists of custom objects.
2. If I use the above approach and make my object inherit from System.Web.Profile.ProfileBase the I will need Umbraco configuration to set up the profiles etc and this will couple my tests to the umbraco database which I really don't want.
3. I need to be able to run simple reporting off the properties of the MyComplexMember and don't know how best to go about this if Umbraco is holding all the values in XML in the DB.
It would be great to get some pointers with these questions,
As for how you then put this in with Umbraco you would probably need a custom data type which you can use to display the info in the Umbraco back end. The data type can be designed to serialize/ deserialize XML too so you can work with it.
I'm pretty sure that the member info isn't stored as XML though, I know it's not stored outside of the database, that'd be a bit crazy a security problem :P
Thanks for the reply Slace. I was reading you blgo and noticed you are familiar with unit testing. So if I am tightly coupling my member class to the ASP.Net membership provider that hooks into Umbraco which in turn hits the database this goes against unit testing principles. How can I break the coupling between my code and umbraco?
I was going to inherit the ProfileBase on a Member DTO type object I have, all it is used for is transfering data with a little bit fo logic (i.e. get age from birth date).
The problem is when I do this I will need to add in config settings into the test assembly for testing the Profile as it is hooked into ASP.Net membership.
Any ideas as to how best break that dependency and insert a "seam"?
It's somewhat on oxymoron having your DTO inherit from ProfileBase, you'd then be coupling a descoped class to a highly scoped base class.
I can't think of any kind of implementation which would let you completely DTO a profile using the ASP.Net membership.
Using WebForms MVP and any mocking framework you can create a stub version of a profile provider and a bunch of stuff around it. That's how you'd do your unit test, integration testing is a whole different problem though :P
Umbraco Membership Problem
I have a complex custom member type that has a lot of associated properties
MyComplexMember
|- Id (int)
|- LastName (string)
|- FirstName (string)
|- CustomObjectList (List<MyCustomObject>)
The member needs to be this complicated as it is used in a calculation engine. Due to the complexity I have written tests around the logic and this means I have a safety net to ensure the calculation is correct.
There are a few things I am struggling with:
1. How best to tie my MyComplexMember to umbraco, I have read the following article but it only deals with simple objects (i.e. strings) and I need to know how to handle generic Lists of custom objects.
http://www.aaron-powell.com/umbraco-members-profiles
2. If I use the above approach and make my object inherit from System.Web.Profile.ProfileBase the I will need Umbraco configuration to set up the profiles etc and this will couple my tests to the umbraco database which I really don't want.
3. I need to be able to run simple reporting off the properties of the MyComplexMember and don't know how best to go about this if Umbraco is holding all the values in XML in the DB.
It would be great to get some pointers with these questions,
Thanks in advance,
B
Here's an MSDN article on how to work with ASP.NET profiles, it also includes info on complex types: http://msdn.microsoft.com/en-us/library/d8b58y5d.aspx
As for how you then put this in with Umbraco you would probably need a custom data type which you can use to display the info in the Umbraco back end. The data type can be designed to serialize/ deserialize XML too so you can work with it.
I'm pretty sure that the member info isn't stored as XML though, I know it's not stored outside of the database, that'd be a bit crazy a security problem :P
Thanks for the reply Slace. I was reading you blgo and noticed you are familiar with unit testing. So if I am tightly coupling my member class to the ASP.Net membership provider that hooks into Umbraco which in turn hits the database this goes against unit testing principles. How can I break the coupling between my code and umbraco?
Do you need to test the saving of your profiles, shouldn't that be expected to work through the underlying provider?
If you're using WebForms MVP though you can stub the HttpContext.Profile object and then access that in your presenter.
I was going to inherit the ProfileBase on a Member DTO type object I have, all it is used for is transfering data with a little bit fo logic (i.e. get age from birth date).
The problem is when I do this I will need to add in config settings into the test assembly for testing the Profile as it is hooked into ASP.Net membership.
Any ideas as to how best break that dependency and insert a "seam"?
It's somewhat on oxymoron having your DTO inherit from ProfileBase, you'd then be coupling a descoped class to a highly scoped base class.
I can't think of any kind of implementation which would let you completely DTO a profile using the ASP.Net membership.
Using WebForms MVP and any mocking framework you can create a stub version of a profile provider and a bunch of stuff around it. That's how you'd do your unit test, integration testing is a whole different problem though :P
is working on a reply...