/********************************************************
* ADO.NET 2.0 Data Provider for SQLite Version 3.X
* Written by Robert Simpson (robert@blackcastlesoft.com)
*
* Released to the public domain, use at your own risk!
********************************************************/
namespace SQLite.Designer
{
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data.Common;
using System.Data;
///
/// This object provides a designer for a SQLiteCommand. The reason we provide an additional
/// CommandDesignTimeVisible property is because certain MS designer components will look for it and
/// fail if its not there.
///
[ProvideProperty("CommandDesignTimeVisible", typeof(IDbCommand))]
internal sealed class SQLiteCommandDesigner : ComponentDesigner, IExtenderProvider
{
public SQLiteCommandDesigner()
{
}
///
/// Initialize the instance with the given SQLiteCommand component
///
///
public override void Initialize(IComponent component)
{
base.Initialize(component);
}
///
/// Add our designtimevisible attribute to the attributes for the item
///
///
protected override void PreFilterAttributes(System.Collections.IDictionary attributes)
{
base.PreFilterAttributes(attributes);
DesignTimeVisibleAttribute att = new DesignTimeVisibleAttribute(((DbCommand)Component).DesignTimeVisible);
attributes[att.TypeId] = att;
}
///
/// Provide a get method for the CommandDesignTimeVisible provided property
///
/// The SQLiteCommand we're designing for
/// True or false if the object is visible in design mode
[Browsable(false), DesignOnly(true), DefaultValue(true)]
public bool GetCommandDesignTimeVisible(IDbCommand command)
{
return ((DbCommand)command).DesignTimeVisible;
}
///
/// Provide a set method for our supplied CommandDesignTimeVisible property
///
/// The SQLiteCommand to set
/// The new designtime visible property to assign to the command
public void SetCommandDesignTimeVisible(IDbCommand command, bool visible)
{
((DbCommand)command).DesignTimeVisible = visible;
}
#region IExtenderProvider Members
///
/// We extend any DbCommand
///
/// The object being tested
/// True if the object derives from DbCommand
public bool CanExtend(object extendee)
{
return (extendee is DbCommand);
}
#endregion
}
}