This project has moved. For the latest updates, please go here.

How to Create Switch bussiness Object?

May 22, 2011 at 10:40 AM

I have a table:

CREATE TABLE [MM].[ItemGroup](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](10) NOT NULL,
	[Description] [varchar](100) NULL,
	[ParentId] [int] NULL,
	[LastChanged] [timestamp] NOT NULL,
 CONSTRAINT [PK_ProductCategory_Id] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [MM].[ItemGroup]  WITH CHECK ADD  CONSTRAINT [FK_ItemGroup_ItemGroup] FOREIGN KEY([ParentId])
REFERENCES [MM].[ItemGroup] ([Id])
GO

ALTER TABLE [MM].[ItemGroup] CHECK CONSTRAINT [FK_ItemGroup_ItemGroup]
GO

and what steps to create the tree Object with the cslagen?

Coordinator
May 23, 2011 at 7:00 AM
Edited May 23, 2011 at 10:55 PM

Hi Cuigs,

Currently EditableSwitchable should be working only for target CSLA2 and C#. You should go to the Schema Objects panel, right click on your table and Create Editable Root. Then  go to Csla Object Info panel and under 01. Common Options change the Csla Object Type to EditableSwitchable and fill all relevant options under 04 Child Object Options. I haven't use it for a very long time but I think you must also set some special criteria.

Switchable objects have the lowest priority. Since this isn't part of the original CslaGen I thought about hiding it altogether. But then again, this is CTP 3 and the idea is to show what we are planning to do.

Editable Switchable isn't a primary Csla stereotype and Rocky has expressed several times the idead that usually it reflects a bad design and one should re-think the whole object design. You might have a look at several forum threads about the use of Editable Switchable, namely the latest one Using Csla 4: whatever happened to "switchable objects”?

May 24, 2011 at 3:49 PM

I need a tree model as below:

Node1

+Node11

++Node111

++Node112

+Node12

Node2

+Node21

++Node22

 

how to setup the readonly object with Cslagen?

 

 

 

 

 

 

 

 

Coordinator
May 24, 2011 at 9:19 PM

Hi Cuig,

Just to make sure everything is in the best shape, download the latest source and compile it. For creating business objects, just have a look at http://cslagenfork.codeplex.com/wikipage?title=Cheat%20Sheet

May 25, 2011 at 6:49 AM

Hi, tiago

thanks for your reply.

The model of cheat sheet is clearly to define two tiers with three objects

Doc

+cover

+pages

 

But in my case,  the tiers will be define by the customer. Before i used read only switchable objects to setup the model.

ItemList

Iteminfo