AspnetPersonalizationperuserCommands Partial Class

This command factory creates static partial classes that generate parameterized database commands to the ASP.NET database, in this case the “personalizationperuser” table. This partial class could be extended to include your own queries if you desired.

[csharp]

 //*****************************************************************************
// This file is part of the data access layer example to the ASP.NET 2.0 provider database
// This file was written by Adam Buenz [WSS MVP] of ARB Security Solutions, LLC
// http://www.sharepointsecurity.com
//
// This file and its parts is free for re-distribution, for use in both free
// and commercial applications, however this header must remain intact for legal
// use. The data access layer example is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//*****************************************************************************
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Aspnet.Provider.Datalayer.Commands
{
///

/// A command factory class for AspnetPersonalizationperuser objects.
///

internal static partial class AspnetPersonalizationperuserCommands
{
///

/// Finds all AspnetPersonalizationperuser objects with a certain Pathid value.
///

/// The Pathid value. /// An IDbCommand that finds all AspnetPersonalizationperuser objects with a certain Pathid value.
public static IDbCommand FindByPathid(Nullable pathid)
{
SqlCommand cmd;
if (!pathid.HasValue)
cmd = new SqlCommand(“select * from [dbo].[aspnet_PersonalizationPerUser] where [PathId] is null”);
else
{
cmd = new SqlCommand(“select * from [dbo].[aspnet_PersonalizationPerUser] where [PathId] = @pathid”);
cmd.Parameters.AddWithValue(“@pathid”, pathid);
}
return cmd;
}

///

/// Finds all AspnetPersonalizationperuser objects with a certain Userid value.
///

/// The Userid value. /// An IDbCommand that finds all AspnetPersonalizationperuser objects with a certain Userid value.
public static IDbCommand FindByUserid(Nullable userid)
{
SqlCommand cmd;
if (!userid.HasValue)
cmd = new SqlCommand(“select * from [dbo].[aspnet_PersonalizationPerUser] where [UserId] is null”);
else
{
cmd = new SqlCommand(“select * from [dbo].[aspnet_PersonalizationPerUser] where [UserId] = @userid”);
cmd.Parameters.AddWithValue(“@userid”, userid);
}
return cmd;
}

///

/// Finds all AspnetPersonalizationperuser objects with a certain Pagesettings value.
///

/// The Pagesettings value. /// An IDbCommand that finds all AspnetPersonalizationperuser objects with a certain Pagesettings value.
public static IDbCommand FindByPagesettings(byte[] pagesettings)
{
SqlCommand cmd;
if (pagesettings == null)
cmd = new SqlCommand(“select * from [dbo].[aspnet_PersonalizationPerUser] where [PageSettings] is null”);
else
{
cmd = new SqlCommand(“select * from [dbo].[aspnet_PersonalizationPerUser] where [PageSettings] like @pagesettings”);
cmd.Parameters.AddWithValue(“@pagesettings”, pagesettings);
}
return cmd;
}

///

/// Finds all AspnetPersonalizationperuser objects with a certain Lastupdateddate value.
///

/// The Lastupdateddate value. /// An IDbCommand that finds all AspnetPersonalizationperuser objects with a certain Lastupdateddate value.
public static IDbCommand FindByLastupdateddate(DateTime lastupdateddate)
{
SqlCommand cmd;
cmd = new SqlCommand(“select * from [dbo].[aspnet_PersonalizationPerUser] where [LastUpdatedDate] = @lastupdateddate”);
cmd.Parameters.AddWithValue(“@lastupdateddate”, lastupdateddate);
return cmd;
}

}
}

[/csharp]

Share

Leave a Reply

Your email address will not be published. Required fields are marked *