本文整理汇总了C#中System.Web.Profile.ProfileInfoCollection.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# ProfileInfoCollection.Cast方法的具体用法?C# ProfileInfoCollection.Cast怎么用?C# ProfileInfoCollection.Cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Profile.ProfileInfoCollection
的用法示例。
在下文中一共展示了ProfileInfoCollection.Cast方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
return DeleteProfiles(profiles
.Cast<ProfileInfo>()
.Select(profile => profile.UserName)
.ToArray());
}
示例2: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
var deleteCount = 0;
try {
deleteCount = profiles.Cast<ProfileInfo>().Count(p => DeleteProfile(p.UserName));
} catch (Exception ex) {
if (WriteExceptionsToEventLog) {
WriteToEventLog(ex, "DeleteProfiles(ProfileInfoCollection)");
throw new ProviderException(exceptionMessage);
}
throw;
}
return deleteCount;
}
示例3: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
Condition.Requires(profiles, "profiles").IsNotNull();
int i;
using (var db = this.ConnectToDatabase())
{
DeleteUserInRoles(db, profiles);
DeleteOAuthMembership(db, profiles);
DeleteMembership(db, profiles);
i =
profiles.Cast<ProfileInfo>()
.Sum(profile => db.Execute(this.sqlQueryBuilder.DeleteProfile, profile.UserName));
}
return i;
}
示例4: DeleteProfiles
/// <summary>
/// When overridden in a derived class, deletes profile properties and information for the supplied list of profiles.
/// </summary>
/// <param name="profiles">A <see cref="T:System.Web.Profile.ProfileInfoCollection"></see> of information about profiles that are to be deleted.</param>
/// <returns>
/// The number of profiles deleted from the data source.
/// </returns>
public override int DeleteProfiles(ProfileInfoCollection profiles) {
if (profiles == null)
throw new ArgumentNullException("profiles");
IEnumerable<string> profilesToDelete = profiles.Cast<ProfileInfo>().Select(p => p.UserName);
return this.DeleteProfiles(profilesToDelete.ToArray());
}
示例5: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
if (!this.Initialized || this.ReadOnly)
{
return 0;
}
string[] usernames = (from profile in profiles.Cast<ProfileInfo>() select profile.UserName).ToArray<string>();
return this.DeleteProfiles(usernames);
}
示例6: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
if (profiles == null) {
throw TraceException("DeleteProfiles", new ArgumentNullException("profiles"));
}
if (profiles.Count == 0) {
return 0;
}
return DeleteProfiles(profiles.Cast<ProfileInfo>().Select(p => p.UserName).ToArray());
}
示例7: DeleteProfiles
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
var count = 0;
Parallel.ForEach(profiles.Cast<ProfileInfo>(), profile =>
{
if (DeleteProfile(profile.UserName, profile.IsAnonymous))
Interlocked.Increment(ref count);
});
return count;
}
示例8: DeleteUserInRoles
private void DeleteUserInRoles(IDatabase db, ProfileInfoCollection profiles)
{
this.DeleteUserInRoles(db, profiles.Cast<ProfileInfo>().Select(x => x.UserName).ToArray());
}
示例9: DeleteOAuthMembership
private void DeleteOAuthMembership(IDatabase db, ProfileInfoCollection profiles)
{
this.DeleteOAuthMembership(db, profiles.Cast<ProfileInfo>().Select(x => x.UserName).ToArray());
}
示例10: DeleteProfiles
/// <summary>
/// When overridden in a derived class, deletes profile properties and information for the supplied list of profiles.
/// </summary>
/// <returns>The number of profiles deleted from the data source.</returns>
/// <param name="profiles">A <see cref="T:System.Web.Profile.ProfileInfoCollection" /> of information about profiles that are to be deleted.</param>
public override int DeleteProfiles(ProfileInfoCollection profiles)
{
if (profiles == null)
{
throw new ArgumentNullException("profiles");
}
if (profiles.Count < 1)
{
throw new ArgumentException("profiles");
}
string[] usernames = profiles.Cast<ProfileInfo>().Select(p => p.UserName).ToArray();
return DeleteProfiles(usernames);
}