Select Page

Art of BI: Simple SubSonic Project Collection Retrieve

Christian Screen | | July 4, 2009

Using the subsonic project ORM for .NET clearly has tons of benefits for DAL and BLL purposes.

A great way to get a list of records from the db is to use the collection object which is created for tables and view objects from the db.

Here are two examples of how to use the .Load() method and overload to get data in a collection for which you can loop through using a foreach() statement.

Using the Query Object with Collection Object
[sourcecode language=’csharp’]
Query q = new Query(Views.Accounts);
q.WHERE(“accountID”, Comparison.Equals, _accountID.value.ToString());

AccountsCollection obj1 = new AccountsCollection();
obj1.Load(q.ExecuteReader());
[/sourcecode]

Using only the Collection Object
[sourcecode language=’csharp’]
AccountsCollection obj1 = new AccountsCollection().Where(“accountID”, Comparison.Equals, accountID.value.ToString()).Load();
[/sourcecode]
 

Now, to loop through the Collection
Once the collection has been instantiated and the Load() method called a foreach() loop can take place to get the records.
[sourcecode language=’csharp’]
if (obj1.Count > 0)
{
   foreach (Accounts x in obj1)
   {
      Console.Write(“My Account Name is {0}”, x.AccountName);
   }
}
else
   Console.Write(“There are no accounts in the collection”);
[/sourcecode]

12c Upgrade Bug with SQL Tuning Advisor

This blog post outlines steps to take on Oracle upgrade 11.2 to 12.1 if you’re having performance problems. Oracle offers a patch and work around to BUG 20540751.

Megan Elphingstone | March 22, 2017

Oracle EPM Cloud Vs. On-Premises: What’s the Difference?

EPM applications help measure the business performance. This post will help you choose the best EPM solutions for your organization’s needs and objectives.

Bobby Ellis | April 10, 2018

Scripting Out the Logins, Server Role Assignments, and Server Permissions

Imagine there are over one hundred logins in the source server and you need to migrate them all over to the destination server. Wouldn’t it be awesome if we could automate the process by generating the scripts for the required tasks?

JP Chen | October 1, 2015

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.

CONTACT US

Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.

EXPLORE JOBS