Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Optimal Structure of DAL?Optimal Structure of DAL?
Previous
 
Next
New Post
12/16/2009 3:42 AM
 

I am creating a module that works with (monthly) mutual fund returns.
I would appreciate it if you could help me out with the right structure of my Data Access Layer (DAL). The current structure seems unnecessarily complex.

In SQL Server I have a table to store the monthly returns of a lot of mutual funds.
The table has the following fields:
id
MutualFundName
Month
Return

I created a MutualFundReturnInfo class in my DNN module with the same properties. 1 instance of the MutualFundReturnInfo class contains 1 monthly return for 1 mutual fund. But I need to work with all the monthly returns (of 1 mutual fund), not just the return for 1 month (of 1 mutual fund). Therefore I created a List(Of MutualFundReturnsInfo).
But I'm doing calculations on the returns with an external statistical program that only works with arrays (not with my List(Of MutualFundReturnsInfo)).
So I have to extract the monthly returns out of this List(Of MutualFundReturnsInfo) (into an array).
Because the List(Of MutualFundReturnsInfo) also contains the id, MutualFundName and Month. (I do need this information later on.)

Is this the best approach or is there a better and easier way to work with the monthly returns? My current structure seems unnecessarily complex.

Help is much appreciated.

 
New Post
12/16/2009 8:36 AM
 

I dont think that your solution is unnecessarily complex, but is general and flexible enough to cover both your current need (the array) and the future need (all the Info data).

You could move the creating of the array into the database in a stored procedure, but that would normally be a solution if performance was an issue (which i dont think is the case with monthly data). Because you still need the info class, I think that this would just add to the complexity of the DAL.

One could also argue that you should normalize the MutualFundName into a separate table, but then you would really add to the complexity of the DAL with two info classes and a relation between these.

Another solution could be that you moved the month and return fields into an xml field, that could hold your full list. But my guess is that the code needed to encode and decode the xml would be even more complex that your current solution.


/Bo Nørgaard ( www.dotnetnuke.dk )
 
New Post
12/17/2009 2:26 AM
 

Hi ,

If you are  doing external calc. on data than i don't think so your approch is good but what i suggest is do your return calculation in backend in your SP if possible and return SQL result directly to frontend side. So you can directly bind into contol.

So in future if any change than you can directly change calc. logic in SP.

 thanks

Sahilmahammad

 
New Post
12/17/2009 5:52 AM
 

Thank you both for your reply!

@Sahilmohammad: when you talk about SP are you talking about SQL server stored procedures or of some sort of (service) provider? If you're referring to a stored procedure: given the fact that I'm working with time series, I'm guessing stored procedures aren't easy to work with. I would probably have to use SQLCLR but even then...

 
New Post
12/17/2009 6:45 AM
 

oh, i thought you are using DB server like SQL or Oracle so that's why i am suggsting SP (Store Procedure).

Any ways, one thing i can suggest is , once you are calculating return you can cache it and used this 'll help you to improve application perfomance. As your using DNN you don't have to worry about caching because it's giving class ready to use.

May this help.

 

Sahilmahamammad

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Optimal Structure of DAL?Optimal Structure of DAL?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out