. NET 2.0, provides asp.net membership management, ASP. NET role management and ASP.net configuration file properties. In this paper, we focus on the design and implementation of the. Net PetShop 4.0 profile property management.
Profile properties are used to provide personalized service to users. In. Net PetShop 4.0, the same namespace as the profile properties is as follows:
PetShop.IProfileDAL
PetShop.OracleProfileDAL
PetShop.SQLProfileDAL
PetShop.ProfileDALFactory
PetShop.Profile
From their namespaces, you can see that the configuration file property management also uses the factory pattern. Let's look at the contents of each namespace in detail:
First, Petshop.iprofiledal namespaces
The Petshop.iprofiledal namespace provides an interface ipetshopprofileprovider that defines 10 methods, respectively:
GetAccountInfo
SetAccountInfo
GetCartItems
SetCartItems
UpdateActivityDates
GetUniqueID
CreateProfileForUser
GetInactiveProfiles
DeleteProfile
GetProfileInfo
Some of these methods are for shopping cart processing, some of the account information processing, some of the configuration file processing.
Second, Petshop.oracleprofiledal and Petshop.sqlprofiledal namespaces
The two namespaces each contain a Petshopprofileprovider class, which is an implementation of the interface Ipetshopprofileprovider. Of course, as can be seen from the name of the namespace, Petshop.oracleprofiledal is connected to the Oracle database, Petshop.sqlprofiledal is connected to the SQL Server database.
Three, petshop.profiledalfactory namespaces
Petshop.profiledalfactory provides a self-appointed class dataaccess, which has only one method Createpetshopprofileprovider, according to the Profiledal settings in Web.config, produces a conforming ipetsh Petshopprofileprovider class instance of the Opprofileprovider interface. Of course, this is the typical factory model.
Four, Petshop.profile namespaces
The Petshop.profile namespace provides a human-encapsulated class Petshopprofileprovider that inherits the. NET Framework ProfileProvider classes, overriding initialize, SettingsPropertyValueCollection, Setpropertyvalues, Deleteprofiles, Deleteprofiles, DeleteInactiveProfiles, Findprofilesbyusername, Findinactiveprofilesbyusername, Getallprofiles, Getallinactiveprofiles and Getnumberofinactiveprofiles methods, some static methods are created. A static method is created to implement a call to a method in Petshopprofileprovider through the PetShop.ProfileDALFactory.DataAccess class.