Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Gerard O Carroll (11/30/2010) This might sound like a silly question but I 'Asumed' that a primary key field in SQL 'had' to be unique and you could not have duplicates ?. This must'nt be the case if you have written a routine to validate it ?? Hi Gerard, Nothing silly about it. Even thought you may come across an Integer PK which is not auto incremented by the database, but you are right. That was a code I wrote fast without testing for Terry, but was corrected in the following messages.
Edhy Rijo
|
|
|
Ger Cannoll
|
|
Group: StrataFrame Users
Posts: 430,
Visits: 507
|
Hi Edhy.
This might sound like a silly question but I 'Asumed' that a primary key field in SQL 'had' to be unique and you could not have duplicates ?. This must'nt be the case if you have written a routine to validate it ??
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Yeap you are now in the right track, so go for it. Also for your current BO all you need to do is change the Inherits to your new base BO, the same thing applies to forms and other controls.
Edhy Rijo
|
|
|
Terry Bottorff
|
|
Group: Forum Members
Posts: 448,
Visits: 12K
|
So let me get this straight. - I create a BO (say BaseBO) and I don't map it to any table.
- I then add MY Functions, Sub Routines and whatever to my BaseBO.
- Once I have 1 and 2 done Then when I create a new BO I change the Inherits MicroFour.Strataframe.Business.BusinessLayer
- to Inherits Rodeo.Business.BaseBO Where Rodeo is I believe my Namespace.
TIA.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Terry, Yes, there are some sample code in the forums, probably Ivan (the Google expert) may provide some links, but basically this what you have to do: - Create a BO class and do not map it to any of your tables. You could name it whatever you want, I name mine "ApplicationBaseBusinessClass.vb"
- Add all the custom, generic code you expect to use in all your BOs like the ones I posted here. Also if you use some custom field properties in all your BO with the same name, here is a good place to have them all.
- In your current and new BO, change the "Inherits" statement from:
Inherits MicroFour.StrataFrame.Business.BusinessLayer to Inherits CardTrackingSystem.Business.ApplicationBaseBusinessClass
Of course in the sample above the namespace "CardTrackingSystem" should be replace with your own NameSpace. After that, recompile your project and start having fun with your base BO class.
Edhy Rijo
|
|
|
Terry Bottorff
|
|
Group: Forum Members
Posts: 448,
Visits: 12K
|
Is there some where I can find a basic subclass of the BO that has Everything that is needed to make it work so I can start adding some of these functions and not have to do it on Every BO? Thanks in Advance.
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Charles R Hankey (11/29/2010) (... reading that over it probably doesn't make any sense unless you've been playing with TVPs but for anybody who has, the TVP as empty table if no param is passed came as a surprise to me and somebody may find it useful )Hi Charles, I have not worked with a TVP yet. I have a consultant "Uri Dimant" which is a MS SQL MVP which helps me with those deep needs and even though he is pretty good explaining this type of things with MS-SQL, sometimes I don't have the luxury to pay to much of attention to details. He has created some complex stored procedures to deal with millions of records and re-factored those couple of times to take advantage of new functionality of MS-SQL 2008 R2. In case you or anyone needs serious help with any MS-SQL problem, feel free to contact him.
Edhy Rijo
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Terry Bottorff (11/29/2010) ...but now with All of the Great Ideas I will be looking to change almost all of my fill routines. Hi Terry, I've been there, done that! Welcome to the club Glad you find it useful.
Edhy Rijo
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
I think your idea of an array for multiple fields is very good, especially in keeping the function as generic as possible.
Just as an aside : I've been working a lot with using table value parameters in stored procedures and I'm really interested to find that unlike other type of params, you don't need to account for *not* passing the param - the TVP in the sproc will just be an empty table. Interesting in that you can write where clauses in the sproc that let you receive either a single or TVP param for comparison and it will work depending on what you pass in.
( reading that over it probably doesn't make any sense unless you've been playing with TVPs but for anybody who has, the TVP as empty table if no param is passed came as a surprise to me and somebody may find it useful )
|
|
|
Terry Bottorff
|
|
Group: Forum Members
Posts: 448,
Visits: 12K
|
I did find the Primary Key problem and I was able to change that but now with All of the Great Ideas I will be looking to change almost all of my fill routines.
|
|
|