Sunday, March 11, 2012

CLR programming: best place to define utilities functions

Hallo,

I find the CLR integration very handy and I would like to use it in the proper way but I need some helps because is not easy to find "best practice" programming info.

This is what I have to do: from a "period" coming from the DB I have to compute start/End date and save them in the DB.

The computation involves regular expression and several functions that makes several calculations on date type variable.

I have created my UserDefinedFunction class that contains the TV function to return a row with 2 fields (startdate,enddate).
Now my question is: what is the base place to define my utilities functions that perform the computation?
In the same class or it is better to add a new class?

For example I have created a module that contains all the Regular expressions patterns.

Any help is appreciated!

Thankx

Marina B.

I think that this is no matter of a SSQL Server decision rather than a cidong decision. It is always good to have a namespace schema and separated classes which allow you to reuse your your. I would split the regular expressions in you case out of the datetime classes if you want to use them in other projects as well. If this is an internal regular expression calculation you should use them in the same class (and make them evtl. internal if you don′t want to call them directly from SQL Server).

Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment