If you handle the filldatatable, it should catch everything. Is this not what you are experiencing? The BaseBO for FillDataTable is not firing off. Here is my code:
The base bo is called : TrustedVALETBaseBO and inherits from MicroFour.StrataFrame.Business.BusinessLayer
using MicroFour.StrataFrame.Business;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.Serialization;
using System.Text;
using System.Data.Common;
using System.Data.OleDb;
using System.Text.RegularExpressions;
using System.Data.OracleClient;
namespace TrustedVALET_BO
{
[Serializable()]
public partial class TrustedVALETBaseBO : MicroFour.StrataFrame.Business.BusinessLayer
{
public enum DatabaseType : int
{
SQLServer = 0,
Oracle = 1
}
#region Constructors
/// <summary>
/// Initializes a new instance of the BusinessObject1 class.
/// </summary>
public TrustedVALETBaseBO()
: base()
{
InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the BusinessObject1 class.
/// </summary>
/// <param name="container">The IContainer to which this business object will be added.</param>
public TrustedVALETBaseBO(IContainer container)
: base()
{
container.Add(this);
InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the BusinessObject1 class.
/// </summary>
/// <param name="info">The SerializationInfo for the object to create.</param>
/// <param name="context">The StreamingContext for the source stream.</param>
protected TrustedVALETBaseBO(SerializationInfo info, StreamingContext context)
: base(info, context)
{
InitializeComponent();
}
#endregion
#region Data Retrieval Methods
#endregion
#region Event Handlers
/// <summary>
/// Checks the business rules on the current row
/// </summary>
/// <param name="e"></param>
/// <remarks></remarks>
private void TrustedVALETBaseBO_CheckRulesOnCurrentRow(CheckRulesEventArgs e)
{
}
/// <summary>
/// Sets the default values for a new row
/// </summary>
/// <remarks></remarks>
private void TrustedVALETBaseBO_SetDefaultValues()
{
}
#endregion
private static DatabaseType _DatabaseQueryType = DatabaseType.SQLServer ;
public static DatabaseType DatabaseQueryType
{
get { return _DatabaseQueryType; }
set { _DatabaseQueryType = value; }
}
private OracleCommand ConvertSqlToOracleCommand(SqlCommand cmd)
{
// inserted next 2 lines just to have the code compile
System.Data.OracleClient.OracleCommand strOr = null;
return strOr;
//-- Convert the SqlCommand into an Oracle Command
}
//-- Override the base FillDataTable and add a test to see if the command should be converted to Oracle
public override void FillDataTable(DbCommand cmd)
{
if (TrustedVALETBaseBO.DatabaseQueryType == DatabaseType.Oracle)
cmd = ConvertSqlToOracleCommand((SqlCommand)cmd);
// added write to see if this is being executed
Console.WriteLine("Base class Constructor");
base.FillDataTable(cmd);
}
}
}
The actual database bo for the table is: tbl_BargeClass_1 and inherits from TrustedVALETBaseBO
using
MicroFour.StrataFrame.Business;using System;
using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Data.SqlClient;using
System.Runtime.Serialization;using
System.Text;using
MicroFour.StrataFrame.Security;namespace
TrustedVALET_BO{
[
Serializable()]//public partial class tbl_BargeClass_1 : MicroFour.StrataFrame.Business.BusinessLayerpublic partial class tbl_BargeClass_1 : TrustedVALETBaseBO{
#region
Constructors/// <summary>/// Initializes a new instance of the BusinessObject1 class./// </summary>public tbl_BargeClass_1():
base(){
InitializeComponent();
}
/// <summary>/// Initializes a new instance of the BusinessObject1 class./// </summary>/// <param name="container">The IContainer to which this business object will be added.</param>public tbl_BargeClass_1(IContainer container):
base(){
container.Add(
this);InitializeComponent();
}
/// <summary>/// Initializes a new instance of the BusinessObject1 class./// </summary>/// <param name="info">The SerializationInfo for the object to create.</param>/// <param name="context">The StreamingContext for the source stream.</param>protected tbl_BargeClass_1(SerializationInfo info, StreamingContext context):
base(info, context){
InitializeComponent();
}
#endregion
#region
Data Retrieval Methods#endregion
#region
Event Handlers/// <summary>/// Checks the business rules on the current row/// </summary>/// <param name="e"></param>/// <remarks></remarks>private void tbl_BargeClass_1_CheckRulesOnCurrentRow(CheckRulesEventArgs e){
}
/// <summary>/// Sets the default values for a new row/// </summary>/// <remarks></remarks>private void tbl_BargeClass_1_SetDefaultValues(){
this.BARGECLASS_ENTDT = DateTime.Now;this.BARGECLASS_USERE = SecurityBasics.CurrentUser.UserName;}
#endregion
private void tbl_BargeClass_1_BeforeSave(MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs e){
this.BARGECLASS_UPDT = DateTime.Now;this.BARGECLASS_USERU = SecurityBasics.CurrentUser.UserName;}
}
}
The SF Maintenance form has the tbl_BargeClass_1 BO on the form. This is a typical Maint Form where it has a browse where the user searches and there is no code which I coded to fill th BO other than what the SF framework does internally.