我寫了一個自定義MembershipProvider
,除了一件小事外我的工作真的很棒,我想擴展一下MembershipUser
類。使用自己的屬性擴展.NET MembershipUser
默認看起來是這樣的:
MembershipUser member = new MembershipUser(
providerName: Membership.Provider.Name,
name: db.userName,
providerUserKey: null,
email: db.userEmail,
passwordQuestion: "",
comment: "",
isApproved: true,
isLockedOut: false,
creationDate: db.creationDate,
lastLoginDate: db.lastLoginDate,
lastActivityDate: db.lastActivityDate,
lastPasswordChangedDate: DateTime.Now,
lastLockoutDate: DateTime.Now
);
但我希望把它擴大一點,是這樣的:
MembershipUser member = new MembershipUser(
providerName: Membership.Provider.Name,
name: db.userName,
guid: db.userGuid,
company: db.companyName,
companyGuid: db.companyGuid,
whatever: db.whatever,
providerUserKey: null,
email: db.userEmail,
passwordQuestion: "",
comment: "",
isApproved: true,
isLockedOut: false,
creationDate: db.creationDate,
lastLoginDate: db.lastLoginDate,
lastActivityDate: db.lastActivityDate,
lastPasswordChangedDate: DateTime.Now,
lastLockoutDate: DateTime.Now
);
有沒有一種方法來擴展默認的類?