Last post Jun 25, 2012 12:23 PM by pwmfs33
Jun 22, 2012 11:59 AM|pwmfs33|LINK
I’m trying to determine the best way to give my users different CRUD pages for a single table. Using the Entity Data Model seems wisest, but I’m unsure how to make the best use of it. That usually means it’s time to hit the forums.
The database table is called ta_measurement:
CREATE TABLE [dbo].[ta_measurement](
[MeasurementId] [bigint] IDENTITY(1,1) NOT NULL,
[ProjectId] [bigint] NOT NULL,
[StrategyId] [bigint] NOT NULL,
[MeasurementType] [int] NOT NULL,
[Status] [int] NOT NULL,
[Settings] [int] NOT NULL,
[MeasurementDate] [datetime] NOT NULL,
[MeasurementTitle] [nvarchar](64) NULL,
[MeasurementScore] [float] NOT NULL,
[MeasurementOutcome] [nvarchar](64) NULL,
[Version] [int] NOT NULL,
[Notes] [ntext] NULL,
I have about 30 different ways users expect this table to appear/behave. For example, in the case labeled PH1a, the user only needs to check a box (did they meet the requirement or not?) and some notes:
PH1a. Provides families with contact information for the following services: early childhood and developmental screening, vision, dental, hearing and social-emotional
screening, mental health, and special education<input id="ContentPlaceHolder1_FormView1_ctl04_ctl01___health_contact_information_CheckBox1" value="on" checked="checked" type="checkbox" name="ctl00$ContentPlaceHolder1$FormView1$ctl04$ctl01$__health_contact_information$CheckBox1"
With that information, I want to compute the measurement fields:
Measurement_type = 1;
Measurement_score = 0 (or 1, if the box is checked)
Measurement_outcome = “Provider does meet with families?” [or not, depending on the checkbox]
I’d like advice on the most efficient way to accomplish this? Can/should I do this in the data layer somehow? It seems to my untrained eye like it belongs on the presentation layer.
Other ideas include: Is this best accomplished within the Entity Data Model Designer? Should I map using stored procedures?
Thanks in advance for any suggestions.
Jun 23, 2012 10:29 PM|Decker Dong - MSFT|LINK
I don't understand what you really want……From your description it seems that you wanna use one way to show differnt kinds of Tables……So How？Can you tell us what aim you wanna achieve and maybe we can change to another way……
Jun 24, 2012 05:09 AM|sjnaughton|LINK
Hi pwmfs33, are you asking whether you should use Dynamic Data?
Jun 24, 2012 07:17 PM|pwmfs33|LINK
I'm sorry I wasn't clearer about that. I'm definitely using Dynamic Data, but unsure how
best to use Dynamic Data.
Jun 24, 2012 08:01 PM|pwmfs33|LINK
I'm sorry I wasn't clearer about that. What I need is the opposite. I have one table that I need to show many different ways.
In addition to the PH1a example I included are PH2a (different value in type field), PH2a (different value for settings field), etc. They all get stored in the ta_measurement table, but only need 1 or two data from the user.
I think I just wan to 'map' a couple dozen different entities to the same table, but can't figure out how to make this fit the inheritance examples (Table Per Type and Table Per Hierarchy).
Jun 24, 2012 09:00 PM|Decker Dong - MSFT|LINK
As far as I see，do you mean that you wanna show different kinds of UI with different kinds of tables using DD or do something else？
Jun 24, 2012 09:21 PM|pwmfs33|LINK
I want to show different kinds of UI with the same table using DD.
Jun 25, 2012 04:26 AM|biga|LINK
This may help with your requirement: http://dynamicdatalayout.codeplex.com/
Jun 25, 2012 09:29 AM|sjnaughton|LINK
Hi pwmfs33, you may find what you want on my blog here
http://csharpbits.notaclue.net spcifically see
Securing Dynamic Data 4 (Replay) this uses user detaisl to determin what each user can access i.e. read only read/write etc.
Jun 25, 2012 12:23 PM|pwmfs33|LINK
I've figured out how to prototype what I'd like to do. I'll illustrate below with the 'base' class (maps directly to ta_measurement) and a an 'object' of the derived (PH1a) class.
When the user browses to
http://localhost:61218/ta_measurement/Insert.aspx, they'll get the full form: