C
Colin Basterfield
Hi,
I have some factory classes that all do a common thing, generate a query, so
I thought I would have each of them implement an interface, however it
doesn't seem to let me do it
interface IQueryByCriteriaFactory
{
MySqlCommand Generate(DomainToDBMap dbMap, QueryObject queryObject);
}
and the class that implements it
public class QueryByCriteriaFactory : IQueryByCriteriaFactory
{
#region IQueryByCriteriaFactory Members
public static MySqlCommand IQueryByCriteriaFactory.Generate(DomainToDBMap
dbMap, QueryObject queryObject)
{
return new MySqlCommand(
"select " + dbMap.FullColumnList("", "", false, false)
+ " from " + dbMap.TableName
);
}
#endregion
}
If i do this it says public and static aren't valid for this item.
If I take these out it can't find the method that the caller wants
Obviously I could instantiate this class, but I kinda like the idea of all
factories to use static methods
thoughts anyone?
many thanks
Colin
I have some factory classes that all do a common thing, generate a query, so
I thought I would have each of them implement an interface, however it
doesn't seem to let me do it
interface IQueryByCriteriaFactory
{
MySqlCommand Generate(DomainToDBMap dbMap, QueryObject queryObject);
}
and the class that implements it
public class QueryByCriteriaFactory : IQueryByCriteriaFactory
{
#region IQueryByCriteriaFactory Members
public static MySqlCommand IQueryByCriteriaFactory.Generate(DomainToDBMap
dbMap, QueryObject queryObject)
{
return new MySqlCommand(
"select " + dbMap.FullColumnList("", "", false, false)
+ " from " + dbMap.TableName
);
}
#endregion
}
If i do this it says public and static aren't valid for this item.
If I take these out it can't find the method that the caller wants
Obviously I could instantiate this class, but I kinda like the idea of all
factories to use static methods
thoughts anyone?
many thanks
Colin