Strange profile provider

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
12/9/2006 2:02:06 AM
Gravatar
Total Posts 488

Strange profile provider

Current implementation of mojoProfileProvider seems strange to me. There are overloads for GetPropertyValues() and SetPropertyValues(), but they NEVER work!
If you try to access Context.Profile.PropertyValues.Count property from any page, you will get 0.
As far as I can understand, these methods take the list of properties as parameters. As there are no properties in the <profile><properties> section of web.config, these methods never work.

Are they just "for future"?
12/9/2006 3:00:42 AM
Gravatar
Total Posts 18439

Re: Strange profile provider

Yes, this feature is not finished yet. I plan to finish this implementation for the next release.

I will be implementing something quite different than the typical ASP.NET profile provider because it seems very limiting to me.

Joe
12/19/2006 11:28:05 PM
Gravatar
Total Posts 488

Re: Strange profile provider

I can see you have removed the profile provider from the project.
But the comment in the file is not absolutely correct: there are allowAnonymous and readOnly properties in ASP.NET profile provider model.

http://msdn2.microsoft.com/en-us/library/d8b58y5d(VS.80).aspx


P.S. Some more about the future profile feture:
1. Please add some kind of order to the newly defined properties. It is useful for autogenerating profile pages to make sure they always look the same way.
2. You define some resource keys for property-related strings:
    - What about creating another global resource file to store all of them (ProfileProperties.resx)?
    - what about adding property help string in the same way?
12/20/2006 4:14:29 AM
Gravatar
Total Posts 18439

Re: Strange profile provider

Ok, so they do have readOnly and allowAnonymous but there are still too many things is doesn't have to use it as a starting point.

I am defining allowAnonymous, but that if implemented would really be for tracking properties of an unauthenticated user. What I was thinking about while writing my comments was visableToAnonymous which is about allowing anonymous visitors to view other member's profiles. Currently mojoPortal only allows authenticated users to view the memberlist or user profiles but I'm planning for more flexibility there. Also the readOnly property is insufficient, we might want to allow an admin to edit a property but not the user. The biggest benefit to my planned profile system will be that you can specify which properties are required for registration and these properties will automatically show up on the registration page and there is nothing like this in the regular ProfileProvider API.

What about just using the order in which they are placed in the config file? That seems the most natural thing to do and the easiest to implement? I'm building a collection of ProfilePropretyDefinition objects by reading the config file and they will already be in that order.

It might be ok to use a separate Resource file for this but I'm want to avoid an explosion of Resource files. I think it is easier to manage translation contributions when it is in one file. I think for things implemented as external modules, separate files are the way to go but core features its best for me if they are all in one file per language. Profile is kind of a special case though since the idea is for it to be customizable and while there will be a core set of profile properties included by default, the power of the feature is that any arbitrary properties can be defined. So I guess in this case a separate file is a good idea.

For help I was thinking of using my existing help feature and automatically generating a key like "profile_" + propertykey + "_help"
Help files don't come from the resource but are localizable. I don't really like the explosion of files there either but I haven't found a better way to do it since the help needs to be editable. If we could implement a web based resource editor that would be good. Not sure how feasible it would be though and it seems likely that there would be a problem making it work under Medium trust.

I am defining a regexValidationExpression attribute and a validationErrorResourceKey so a warning for something that doesn't match the regex pattern can be added to the Resource file.
12/20/2006 4:44:54 AM
Gravatar
Total Posts 488

Re: Strange profile provider

I spoke only about the comment in the code file, I agree that in general ASP.NET profile model is very limited.

Using the same order as in config file is a solution.
But be careful when implementing this as some collection classes from .Net framework do not guarantee the elements order to be the same as when adding to the collection.

About the second resource file.
As for me, it would be better if it is a separate file. In this case it is easier to find untranslated and already disappeared strings. We spoke about it a while ago (one resource file vs. many of them for different features).

About help files.
It just would be nice to have all profile properties related strings in one place. If I need to add strings to several locations, it's more complicated.
Online resource editor is a solution, but I am just not common with medium trust problems.
12/20/2006 4:52:01 AM
Gravatar
Total Posts 18439

Re: Strange profile provider

Well for the Profile system you will get your wish, I will use a separate Resource file like ProfileResource.resx
For help files I'm going to have to stick with the current model for now. Its not a perfect solution but it works.

Joe
12/20/2006 4:56:48 AM
Gravatar
Total Posts 488

Re: Strange profile provider

Just a little detail: why not naming it Profile.resx or ProfileProperties.aspx?

When accessing from code anyway you will write something like that:

Resources.ProfileProperties.Birthday
Resources.ProfileProperties.BirthdayValidationFailed

So in code there will be no doubght you really access resources.
12/20/2006 5:08:06 AM
Gravatar
Total Posts 18439

Re: Strange profile provider

That almost sounds like we are storing the Properties in the resource file which we are not. The profile properties are being stored in the db and only Profile System resources are being stored in the .resx file so doesn't it make more sense with syntax like
Resources.ProfileResources.BirthdayLabel
Resources.ProfileResources.BirthdayValidationFailedMessage

Joe
12/20/2006 5:12:55 AM
Gravatar
Total Posts 18439

Re: Strange profile provider

Actually, now that I think of it I will not be using the strongly types syntax because I will be loading controls for these properties dynamically at runtime so I will be using the GetGlobalResource(ResourceFile, ResourcKey) syntax.

Joe
12/20/2006 5:25:04 AM
Gravatar
Total Posts 488

Re: Strange profile provider

As you wish, it's not so important.
You must sign in to post in the forums. This thread is closed to new posts.