In a Trial Version How Can I Fill the B.O.?


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Welcome to the forums Marcio!

As Edhy said, you'll typically need to create fill methods (see the help file) to load the BO. There are a few that are built in that are pretty handy.

  • FillByPrimaryKey: fill BO with a single record, using the PK of the table.
  • FillByParentPrimaryKey: fill BO with records matching a FK to a parent table (think fill orders for a single customer).
  • FillDataTable: This is what you'll use to build your own.

Here is one I use in test apps a lot, just to load some data into a BO for some other test I'm doing. This goes into the BO code file.

/// <summary>
/// Fill the BO with the indicated number of records. This is
/// generic enough to use with any BO.
/// </summary>
public void FillTopN(int n)
{
    //-- Build SQL Statement.
    StringBuilder sqlBuilder = new StringBuilder();
    sqlBuilder.AppendFormat("Select Top {0} *\n", n);
    sqlBuilder.AppendFormat("From {0}", this.TableName);

    //-- Load data.
    using (SqlCommand cmd = new SqlCommand())
    {
         cmd.CommandText = sqlBuilder.ToString();
         this.FillDataTable(cmd);
    }
}


Let us know if you run into any problems.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Marcio, and welcome to the forums.

Basically you are responsible to create the methods to be used to fill your BO with the data you want.  As done in the sample you can create any method you want in the BO that will fill the internal datatable with the records you want.

About the Trial, it will let you do anything you need to test as with the Paid version, so go for it, create your own method and call that method to fill your BO, use the sample code in FillTop100 to see how to create your SELECT statement to get your data.

Edhy Rijo

Marcio Valerio Silva
Marcio Valerio Silva
StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)
Group: Forum Members
Posts: 55, Visits: 929
In a Trial Version How Can I Fill the Business Objects?

The Method FillTop100() showing in on-line Demo  isn´t presente here!



Is it possible fill it with another Method? if yes How Can I? Or is only possible in paid version?

I want to buy , but I would like to try and learn something before.

Thanks!

at,

Marcio Valerio.

at,

Marcio Valerio da Silva
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search