473,583 Members | 3,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET 2.0 Replacing Profile Provider Model (apparently its garbage)

I've got the need to have user information for logged in user in a
readily avaliable page context (a lot like how Profile is) except not suck.

Before we jump to any conclusions, from what I gathered, the
implementation of the provider model is absolute garbage. While I've
seen microsoft employees make other questionable design decisions, I
cant possibly fathom why a user profile cant be derived as some other
object.


Perfect Example --

CustomProfile : ProfileBase

Custom profile having the ability to maintain its own collections,
contain methods etc.

Then simply writing the provider (which in my opinion should have a
reference to a user key of some sort, and context to pass the profile
object back.

Of course this would have made TOO much sense. Instead we have this
intermediate step of converting everything to essentially a giant key
based multidimensiona l array... (GetPropertyVal ues,SetProperty Values)

So my question/goal is hopefully to have somone prove me wrong. All I
really want is..

A) when inherting profilebase objects in web.config, for the
setPropertyValu es and GetPropertyValu es to be called on profile modification

B) Override the Profile property alltogether, since it appears to be
completely and utterly fubar'ed

C) Hopefully not require a bazillion lines of code and user setup to use
my "provider".
Feb 22 '07 #1
11 2086
Hi Weston,

See my reply here to find some guidelance:

http://msdn.microsoft.com/newsgroups...9-6bba015dce34

Let me know if you need more help
--
Milosz
"Weston Weems" wrote:
I've got the need to have user information for logged in user in a
readily avaliable page context (a lot like how Profile is) except not suck.

Before we jump to any conclusions, from what I gathered, the
implementation of the provider model is absolute garbage. While I've
seen microsoft employees make other questionable design decisions, I
cant possibly fathom why a user profile cant be derived as some other
object.


Perfect Example --

CustomProfile : ProfileBase

Custom profile having the ability to maintain its own collections,
contain methods etc.

Then simply writing the provider (which in my opinion should have a
reference to a user key of some sort, and context to pass the profile
object back.

Of course this would have made TOO much sense. Instead we have this
intermediate step of converting everything to essentially a giant key
based multidimensiona l array... (GetPropertyVal ues,SetProperty Values)

So my question/goal is hopefully to have somone prove me wrong. All I
really want is..

A) when inherting profilebase objects in web.config, for the
setPropertyValu es and GetPropertyValu es to be called on profile modification

B) Override the Profile property alltogether, since it appears to be
completely and utterly fubar'ed

C) Hopefully not require a bazillion lines of code and user setup to use
my "provider".
Feb 22 '07 #2
Milosz,

While I see where you are going with your example, I dont quite
understand why the provider model doesnt just expect you to set a
ProfileBase derivative based on a key it provides you.

The whole jumping through the hoops of key value pairs. Also, dont quite
understand why adding inherits flag to the profile element in web.config
effectively prevents SettingsPropert yValueCollectio n from being called.

I really have to say that it would have made a hell of a lot more sense
to have a IProfile object that has some specified props and methods, and
then have something like SetProfile / GetProfile, and implementation of
how you serialize/deserialize etc the object as a whole, is up to you.

Blah. poor design ftw.
Weston
Milosz Skalecki [MCAD] wrote:
Hi Weston,

See my reply here to find some guidelance:

http://msdn.microsoft.com/newsgroups...9-6bba015dce34

Let me know if you need more help
Feb 22 '07 #3
Hi again,

And one more thing,

"Blah. poor design ftw".
I suspect they had much better programmers that we are ;-)

Regards
--
Milosz
"Milosz Skalecki [MCAD]" wrote:
Hi Winston,

I understand your reasoning but ASP.NET 2.0 Profile model is more flexible
than just creating a class with some properties and then serializing /
deserializing to a storage. It's been designed to reduce the time that is
necessary to build web apps.

"...While I see where you are going with your example, I dont quite
understand why the provider model doesnt just expect you to set a ProfileBase
derivative based on a key it provides you. …”

This is because they must have provided base class to use it with prepared
providers and asp.net framework. C# does not fully support multiple
inheritance (only via interfaces) so you’d have to derive from base and
define and implement “IProfile” yourself, or if they implemented for you, how
would they now which property should be serialized by standard provider - hm?
Ok, I know they could use attributes by not standard ones like Serializable
because they have different meaning in this case. Please also note class can
implement many interfaces, so which should be taken as reflected one? In
addition to that, obvious point is Microsoft wanted to provide efficient and
easy way of building applications, even if we both know real life apps are
more complex and it’s highly probable you’re expecting something more
advanced (and you will code it yourself anyway). But there is a chance some
percentage of developers need to define properties in web.config, change
connection string and that’s it, done.

“…The whole jumping through the hoops of key value pairs. Also, dont quite
understand why adding inherits flag to the profile element in web.config
effectively prevents SettingsPropert yValueCollectio n from being called…“.

That’s the price for web.config nature of profile feature and the fact, you
may still define more properties in web.config. It also would not be possible
for standard providers (such as SqlProfileProvi der) to obtain property values
efficiently (without using reflection). Having all values in hash table
requires “only” boxing/unboxing. I know these loops look horrible but as I
said that’s the price.

Best regards

Milosz
Feb 22 '07 #4
Hi Winston,

I understand your reasoning but ASP.NET 2.0 Profile model is more flexible
than just creating a class with some properties and then serializing /
deserializing to a storage. It's been designed to reduce the time that is
necessary to build web apps.

"...While I see where you are going with your example, I dont quite
understand why the provider model doesnt just expect you to set a ProfileBase
derivative based on a key it provides you. …”

This is because they must have provided base class to use it with prepared
providers and asp.net framework. C# does not fully support multiple
inheritance (only via interfaces) so you’d have to derive from base and
define and implement “IProfile” yourself, or if they implemented for you, how
would they now which property should be serialized by standard provider - hm?
Ok, I know they could use attributes by not standard ones like Serializable
because they have different meaning in this case. Please also note class can
implement many interfaces, so which should be taken as reflected one? In
addition to that, obvious point is Microsoft wanted to provide efficient and
easy way of building applications, even if we both know real life apps are
more complex and it’s highly probable you’re expecting something more
advanced (and you will code it yourself anyway). But there is a chance some
percentage of developers need to define properties in web.config, change
connection string and that’s it, done.

“…The whole jumping through the hoops of key value pairs. Also, dont quite
understand why adding inherits flag to the profile element in web.config
effectively prevents SettingsPropert yValueCollectio n from being called…“.

That’s the price for web.config nature of profile feature and the fact, you
may still define more properties in web.config. It also would not be possible
for standard providers (such as SqlProfileProvi der) to obtain property values
efficiently (without using reflection). Having all values in hash table
requires “only” boxing/unboxing. I know these loops look horrible but as I
said that’s the price.

Best regards

Milosz
Feb 22 '07 #5
I wont jump in and say that its the worst thing I've ever seen, after
all, its a fairly complex problem... I've found theres a difference
between engineers, and programmers. Besides the point, I've seen some
ridiculous designs and ridiculous code.

Milosz Skalecki [MCAD] wrote:
Hi again,

And one more thing,

"Blah. poor design ftw".
I suspect they had much better programmers that we are ;-)

Regards
Feb 22 '07 #6
Milosz,

I am really not trying to attack Microsoft... just voicing frustrations
with some of their design decisions...
This is because they must have provided base class to use it with prepared
providers and asp.net framework. C# does not fully support multiple
inheritance (only via interfaces) so you’d have to derive from base and
define and implement “IProfile” yourself, or if they implemented for you, how
would they now which property should be serialized by standard provider - hm?
Ok, I know they could use attributes by not standard ones like Serializable
because they have different meaning in this case. Please also note class can
implement many interfaces, so which should be taken as reflected one? In
addition to that, obvious point is Microsoft wanted to provide efficient and
easy way of building applications, even if we both know real life apps are
more complex and it’s highly probable you’re expecting something more
advanced (and you will code it yourself anyway). But there is a chance some
percentage of developers need to define properties in web.config, change
connection string and that’s it, done.
I wasnt referring to multiple inheritance... I was talking about
Provider model design. When I design software I dont typically plan
stuff out in such a way where ultimately you have control of where data
is coming from, and where its being saved to, but make you jump through
hoops with name value pairs. I mean seriously this is the day and age of
OO design, you think we'd be able to get beyond the concept of a
glorified hashmap. If my provider returned objects I'd basically be
doing the equivalent of re-encoding into some serialized format, then
setting the props, then returning back only to have the framework
re-animate the objects. Ehh, lame.
“…The whole jumping through the hoops of key value pairs. Also, dont quite
understand why adding inherits flag to the profile element in web.config
effectively prevents SettingsPropert yValueCollectio n from being called…“.

That’s the price for web.config nature of profile feature and the fact, you
may still define more properties in web.config. It also would not be possible
for standard providers (such as SqlProfileProvi der) to obtain property values
efficiently (without using reflection). Having all values in hash table
requires “only” boxing/unboxing. I know these loops look horrible but as I
said that’s the price.
Actually my point here was that I can inherit="MyProf ileBase" in my
provider line and it would do what I expect (checking
Profile.<SomeMy ProfileBaseProp ertyand its there with appropriate
type... but looking at breakpoints no matter what you do it wont fire
setvalues/getvalues.

Reasoning because your getter/setter properties are literally to set
values manually (eg, public string name{ get{ return this["name"];}}).
If you want code to be reusable and be just a straight up class with
properties and stuff (regardless of applying ProfileAttribut es) this
code is more or less useless. Your profile class will not ever be
anything but a pretty front end to a multidimensiona l string keyed
array. Again, lame.
So come to find out keeping with good development practices and trying
to have a common place to look for customer information (without jumping
through a million hoops) is a lost cause.

In an effort to make everything more usefull out of the box (which I
will DEFINATELY say microsoft improved on here), I think the provider
model IMPLEMENTATION pretty much crippled because it depends on some
strange intermediate format...

Weston
Feb 22 '07 #7
Howdy,

Definitely. I didn't say also it the best possible design, but i only showed
to you there are points to consider when implementing such feature. I have
seen many ridiculous apps , codes and designs too (my favourite is app with
pages making around 200-300 separate database roundtrips to collect simple
data for every page request) and this is not the case.

Regards,

Milosz
"Weston Weems" wrote:
I wont jump in and say that its the worst thing I've ever seen, after
all, its a fairly complex problem... I've found theres a difference
between engineers, and programmers. Besides the point, I've seen some
ridiculous designs and ridiculous code.

Milosz Skalecki [MCAD] wrote:
Hi again,

And one more thing,

"Blah. poor design ftw".
I suspect they had much better programmers that we are ;-)

Regards
Feb 22 '07 #8
Hi there again,

'In an effort to make everything more usefull out of the box (which I
will DEFINATELY say microsoft improved on here), I think the provider
model IMPLEMENTATION pretty much crippled because it depends on some
strange intermediate format...'

'...Your profile class will not ever be anything but a pretty front end to a
multidimensiona l string keyed array...'

The last statement is true but the main problem is to provide values for
serialization without knowing the storage schema (that's what i reckon mst
wanted with sqlserverprovid er and web.config configuration) as i explained in
my last post. From OOP's point of view it's crap but how would you apprach
the same problem?(config ureable in web.config, no coding, few prepared
providers for lazy programets or low requirements, as fast as possible /
comparing to other methods, extendable..., reusable in different asp.net
parts, and what we don't like :D any lame coder could use it without knowing
much). I definitely agree you can design and implement your own pure
architecture (you can do it anyway) but you'll spend much more time.

'...Actually my point here was that I can inherit="MyProf ileBase" in my
provider line and it would do what I expect (checking
Profile.<SomeMy ProfileBaseProp ertyand its there with appropriate
type... but looking at breakpoints no matter what you do it wont fire
setvalues/getvalues...'

i'm not sure what you mean but in order to make it work you must follow the
same logic in base class:

public class MyProfileBase : System.Web.Prof ile.ProfileBase
{
public string Foo
{
get
{
return (string) base["myproperty "];
}
set
{
base["myproperty "] = value;
}
}
}

Maybe someone from MST will tak part in discussion? Wang?
--
Milosz
"Weston Weems" wrote:
Milosz,

I am really not trying to attack Microsoft... just voicing frustrations
with some of their design decisions...
This is because they must have provided base class to use it with prepared
providers and asp.net framework. C# does not fully support multiple
inheritance (only via interfaces) so you’d have to derive from base and
define and implement “IProfile” yourself, or if they implemented for you, how
would they now which property should be serialized by standard provider - hm?
Ok, I know they could use attributes by not standard ones like Serializable
because they have different meaning in this case. Please also note class can
implement many interfaces, so which should be taken as reflected one? In
addition to that, obvious point is Microsoft wanted to provide efficient and
easy way of building applications, even if we both know real life apps are
more complex and it’s highly probable you’re expecting something more
advanced (and you will code it yourself anyway). But there is a chance some
percentage of developers need to define properties in web.config, change
connection string and that’s it, done.

I wasnt referring to multiple inheritance... I was talking about
Provider model design. When I design software I dont typically plan
stuff out in such a way where ultimately you have control of where data
is coming from, and where its being saved to, but make you jump through
hoops with name value pairs. I mean seriously this is the day and age of
OO design, you think we'd be able to get beyond the concept of a
glorified hashmap. If my provider returned objects I'd basically be
doing the equivalent of re-encoding into some serialized format, then
setting the props, then returning back only to have the framework
re-animate the objects. Ehh, lame.
“…The whole jumping through the hoops of key value pairs. Also, dont quite
understand why adding inherits flag to the profile element in web.config
effectively prevents SettingsPropert yValueCollectio n from being called…“.

That’s the price for web.config nature of profile feature and the fact, you
may still define more properties in web.config. It also would not be possible
for standard providers (such as SqlProfileProvi der) to obtain property values
efficiently (without using reflection). Having all values in hash table
requires “only” boxing/unboxing. I know these loops look horrible but as I
said that’s the price.

Actually my point here was that I can inherit="MyProf ileBase" in my
provider line and it would do what I expect (checking
Profile.<SomeMy ProfileBaseProp ertyand its there with appropriate
type... but looking at breakpoints no matter what you do it wont fire
setvalues/getvalues.

Reasoning because your getter/setter properties are literally to set
values manually (eg, public string name{ get{ return this["name"];}}).
If you want code to be reusable and be just a straight up class with
properties and stuff (regardless of applying ProfileAttribut es) this
code is more or less useless. Your profile class will not ever be
anything but a pretty front end to a multidimensiona l string keyed
array. Again, lame.
So come to find out keeping with good development practices and trying
to have a common place to look for customer information (without jumping
through a million hoops) is a lost cause.

In an effort to make everything more usefull out of the box (which I
will DEFINATELY say microsoft improved on here), I think the provider
model IMPLEMENTATION pretty much crippled because it depends on some
strange intermediate format...

Weston
Feb 22 '07 #9
Milosz,

Exactly... I understand WHY it doesnt call the provider methods. Is
there any way I can completely circumvent profile providers, generate a
ProfileCommon class generator to replace the one in vs.net2005?

Thanks for patience =)

Weston
Milosz Skalecki [MCAD] wrote:
Hi there again,

'In an effort to make everything more usefull out of the box (which I
will DEFINATELY say microsoft improved on here), I think the provider
model IMPLEMENTATION pretty much crippled because it depends on some
strange intermediate format...'

'...Your profile class will not ever be anything but a pretty front end to a
multidimensiona l string keyed array...'

The last statement is true but the main problem is to provide values for
serialization without knowing the storage schema (that's what i reckon mst
wanted with sqlserverprovid er and web.config configuration) as i explained in
my last post. From OOP's point of view it's crap but how would you apprach
the same problem?(config ureable in web.config, no coding, few prepared
providers for lazy programets or low requirements, as fast as possible /
comparing to other methods, extendable..., reusable in different asp.net
parts, and what we don't like :D any lame coder could use it without knowing
much). I definitely agree you can design and implement your own pure
architecture (you can do it anyway) but you'll spend much more time.

'...Actually my point here was that I can inherit="MyProf ileBase" in my
provider line and it would do what I expect (checking
Profile.<SomeMy ProfileBaseProp ertyand its there with appropriate
type... but looking at breakpoints no matter what you do it wont fire
setvalues/getvalues...'

i'm not sure what you mean but in order to make it work you must follow the
same logic in base class:

public class MyProfileBase : System.Web.Prof ile.ProfileBase
{
public string Foo
{
get
{
return (string) base["myproperty "];
}
set
{
base["myproperty "] = value;
}
}
}

Maybe someone from MST will tak part in discussion? Wang?
Feb 23 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1969
by: | last post by:
Hi all, How can I get a reference to my custom profile provider in my .aspx page? I have looked at httpcontext.current.profile. But from there where do I go? Ideally I would like to be able to get default profile provider without having to know the "name" configured in web.config. TIA!
6
2215
by: Shimon Sim | last post by:
Hi I am working on application that need to hold custom user information - Last and first name, email, some other domain related information. I used to create Base class for all my pages. The base class would have CurrentUser property that would hold customer class in session and that was fine for all my situations. Now ASP.NET 2.0 came...
4
2227
by: techsupport | last post by:
I have some experience with .NET Remoting, as well as ASP.NET 2.0, and have been wanting to remote a custom membership and profile provider. I want to take advantage of the new controls in ASP.NET 2.0 such as Login, Loginuser, Loginview, etc. The ASP.NET provider model requires entries in the web.config for a 'connectionStringName', which I...
1
1585
by: Liming | last post by:
Hello, I'm a newbie to .NET 2.0 framework from Java, so please bear with me. Is there a way to do a generic Provider model or if anyone knows a product out there that does this? I know .NET says all you have to do is implement a different provider, but that is some hard work man, who gotta the time to implement a whole new provider??? ...
5
1274
by: cipcip | last post by:
By default profile use sql server xpress provider and probabily, caches stored data when they are requested for the first time, So the question is: why we should use profile instead of storyng, retrieving and caching user data manually from a database? Is it only for an easier approach of state maintenance, or are there other advantages?
1
1799
by: Gregory Gadow | last post by:
Currently, my company's website uses a custom ISAPI filter to map a web user to a network user, and give the user access to our website. This has worked great for several years. We now want to add .NET functionality to our website, and I am looking for a .NET solution to replace the ISAPI authentication. We have Visual Studio 2005, SQL Server...
9
3266
by: Kirk | last post by:
I have successfully, implemented a custom Membership Provider to a SQL 2000 table, however, I am having problems doing the same with a Profile Provider. As I understand it, the steps for both of these are similar: Create a new class (MyMembershipProvider and MyProfileProvider). Add the "Inherits..." value to the provider...
2
2746
by: Annie | last post by:
Hello guys, I have set the MEMBERSHIP, ROLEMANAGER and PROFILE in my config file as below. I just want to use my own sql server 2000 table instead of MSDB.
1
2180
by: Steven Nagy | last post by:
Hi all, I want to know if it is possible to have a WCF service hosted in IIS (.svc) that uses the provider model in .Net? Ideally, I'd like the WCF service methods to detect the user's AD user name automatically (ie not passed as a parameter in the method) such that it uses trusted authentication. The service then access profile...
0
8328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8195
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3820
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3845
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1434
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.