Multiple Tables in an object


Author
Message
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Smile uh, no I have the SF sample database installed.

My point was the data schema Robert send was for two tables that aren't part of the sample data

And I was wondering if before creating the sample you had somehow magically imported from the schema into a DB so you could map with the BO mapper.

I think I was having a bad expressing myself day BigGrin

( but it did get me Googling and it turns out there is indeed a way to create XSD Schemas from SQL 2005 with t_sql and then the there a way of creating data structures in SQL from schemas, but the format Robert used wasn't the one, so I guess that wasn't the intention )

Just trying to catch up on the huge gaps in my basic knowledge of VS/VB tricks w00t

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Is there a command to create the tables in SQL Server from the XSD schema ?

Not that I'm aware of... I wouldn't suspect that it would be in SQL Server Management Studio, but it certainly wouldn't surprise me if there was a 3rd party tool that would do it. 

I downloaded the sample and see to BOs, but I of course have nothing to map them to in sql server.

Hrm... the StrataFrameSample database with sample data should be deployed by the SF install to the same server that the StrataFrame database was installed.  So, unless you skipped that option, you should have some sample data somewhere.

Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Trying to follow along here and perhaps someone will take pity on the XML challenged. I see the XSD schema so I can easily visualize the table structures we're talking about. I see these are not tables currently in the SF sample data.



I downloaded the sample and see to BOs, but I of course have nothing to map them to in sql server.



Since Robert passed his data structure as an XSD Schema and Ben had that data structure in the BO in the sample I think I might be missing something everyone who is not VS - XML challenged knows.



Is there a command to create the tables in SQL Server from the XSD schema ? Aside from doubleclicking the schema and seeing it open into a nice data diagram in VS2005 are there other tricks you can do with it in sql server / VS / DDT that one should know about ?



(understanding everything else involved in the complex business object sample will just require my wading out of the newbie phase in SF )



Any guidance appreciated.

Unsure







StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No, sorry, there aren't any samples that include any of the data for the business object mapper (because we would have to put records into the StrataFrame database to do so...).  So, to explain things a bit better... on the custom code, you would want to put the exact code that would be replace the property that you are customizing.  Meaning that whatever you put in the custom code box will be placed in the partial class as the code for that field property; so, if you wanted to not include a field, then just customize it and leave it completely blank...

As for your second question, yes, you would want to leave the Create Field Descriptor unchecked or the BOMapper will create the FieldPropertyDescriptor for that property.

Michael Cobb
Michael Cobb
StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)StrataFrame Novice (50 reputation)
Group: Forum Members
Posts: 26, Visits: 1K
Hi Ben.  I'm struggling to understand the VB sample. 

You will have to go into the Business Object Mapper and "customize" the State field on the CompanyBO and set it to use "custom code" that will return the readonly property containing the StateBO.

Do I need to create a custom field property for the state in the CompanyBO?  In the Business Object Mapper, what do I need to put in the "custom code" for the State field on the CompanyBO? 

I updated the MicroFour StrataFrame AddIns.dll to modify the Business Object Mapper so that it will not create a FieldPropertyDescriptor for a field overriden with custom code. It will be available in the next update. So, if you reproduce this sample before the next update, you will just have to delete the FieldPropertyDescriptor that is created for the State field on the CompanyBO (it won't work and will just assume the field is still a System.String).

Meaning I would not check the box to create a descriptor?  I apologize for being slow.  Is there a sample project that illustrates the use of the BO Mapper to create custom code?

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, I've uploaded a sample for both C# and VB. Both are identical except where they add the handlers for the events, of course. A little explaination is in order for the samples:



1) All of the necessary code is contained within the "Necessary Code for Complex Business Object" region in the CompanyBO.* file.

2) No extra code was added to the StateBO.

3) You will have to go into the Business Object Mapper and "customize" the State field on the CompanyBO and set it to use "custom code" that will return the readonly property containing the StateBO.

4) I updated the MicroFour StrataFrame AddIns.dll to modify the Business Object Mapper so that it will not create a FieldPropertyDescriptor for a field overriden with custom code. It will be available in the next update. So, if you reproduce this sample before the next update, you will just have to delete the FieldPropertyDescriptor that is created for the State field on the CompanyBO (it won't work and will just assume the field is still a System.String).



---------------------------

Remember, a business object in StrataFrame is just a class, so anything you want to do with it, you can. Just don't modify the designer file outside of the "Component Implementation" region or your changes will be overriden.
Attachments
ComplexBOSampleCS.zip (213 views, 705.00 KB)
ComplexBOSampleVB.zip (205 views, 111.00 KB)
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I'll get it posted ASAP in the morning.
Robert Harvey
Robert Harvey
StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)
Group: Forum Members
Posts: 9, Visits: 28
But, you can post in C#.  Either way works for me.
Robert Harvey
Robert Harvey
StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)StrataFrame Beginner (19 reputation)
Group: Forum Members
Posts: 9, Visits: 28
I have created a similar object using CSLA.  But, it was an icky amount of code to accomplish this.  I started with a base object that inherited System.Data.Dataset.  Then I inherited that object and exposed a dataset property.  A getOrder method to fill it. 

Oh yeah....I use VB. 

Daniel Essin
Daniel Essin
StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)StrataFrame User (339 reputation)
Group: Forum Members
Posts: 235, Visits: 309
Perhaps you could post this sample for downlaod. I use C#.



Thanks
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