Multiple Foriegn Keys


Author
Message
Kevin Lingofelter
Kevin Lingofelter
StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)StrataFrame Novice (123 reputation)
Group: Forum Members
Posts: 77, Visits: 804
Hello,

I have a table with multiple foriegn keys. I'll use an Order table as an example:

OrderID
OrderDate
CustomerID
OrderStatusID
PaymentTypeID

So, in addition to the Order BO (I'll call this primary BO), I'll also have Customer, OrderStatus and PaymentType BOs (I'll call these secondary BOs).

Currently, this is what I'm doing to implement this:

In the primary BO, I have private instances of the secondary BOs, which are filled during the primary BO's instantiation. The primary BO has 5 custom properties:

CustomerCompany
CustomerFirstName
CustomerLastName
OrderStatus
PaymentType

In the get/set methods, I navigate to the proper secondary BO records and return/set the value of the results. 

Is this the best way to handle this?

Thanks!

Kevin

Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Yes, but scalar overhead is practically nothing.  If you actually create a SELECT command it will create more overhead.  If you are talking about thousands of records then you can create a BO and populate it first, but in my experience it usually ends up being faster using scalar methods.

If you put a packet sniffer on the network adapter that talks to the SQL Server and see the traffic, you will see that there is no additional formatting on the scalar method.  However, if you create a SELECT statement, it will create much more network traffic.

This is really the purpose of scalar methods.  To grab just a piece of data extremely fast.

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