CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ObjectViewSchema.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ObjectViewSchema.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Object providing schema information for a</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections;
10using System.Collections.Generic;
11using System.Web.UI.Design;
12using System.ComponentModel;
13using System.ComponentModel.Design;
14using Csla;
15using Csla.Web.Design;
16
17namespace Csla.Web.Design
18{
19
24 [Serializable()]
25 public class ObjectViewSchema : IDataSourceViewSchema
26 {
27 private string _typeName = "";
28 private CslaDataSourceDesigner _designer;
29
36 public ObjectViewSchema(CslaDataSourceDesigner site, string typeName)
37 {
38 _typeName = typeName;
39 _designer = site;
40 }
41
49 public System.Web.UI.Design.IDataSourceViewSchema[] GetChildren()
50 {
51 return null;
52 }
53
64 public System.Web.UI.Design.IDataSourceFieldSchema[] GetFields()
65 {
66 ITypeResolutionService typeService = null;
67 List<ObjectFieldInfo> result = new List<ObjectFieldInfo>();
68
69 if (_designer != null)
70 {
71 Type objectType = null;
72 try
73 {
74 typeService = (ITypeResolutionService)(_designer.Site.GetService(typeof(ITypeResolutionService)));
75 objectType = typeService.GetType(_typeName, true, false);
76
77 if (typeof(IEnumerable).IsAssignableFrom(objectType))
78 {
79 // this is a list so get the item type
80 objectType = Utilities.GetChildItemType(objectType);
81 }
82 PropertyDescriptorCollection props = TypeDescriptor.GetProperties(objectType);
83 foreach (PropertyDescriptor item in props)
84 {
85 if (item.IsBrowsable)
86 {
87 result.Add(new ObjectFieldInfo(item));
88 }
89 }
90 }
91 catch
92 { /* do nothing - just swallow exception */ }
93 }
94
95 return result.ToArray();
96 }
97
101 public string Name
102 {
103 get
104 {
105 return "Default";
106 }
107 }
108 }
109}
Implements designer support for CslaDataSource.
Contains schema information for a single object property.
Object providing schema information for a business object.
System.Web.UI.Design.IDataSourceFieldSchema[] GetFields()
Returns schema information for each property on the object.
System.Web.UI.Design.IDataSourceViewSchema[] GetChildren()
Returns a list of child schemas belonging to the object.
string Name
Returns the name of the schema.
ObjectViewSchema(CslaDataSourceDesigner site, string typeName)
Create an instance of the object.
@ Serializable
Prevents updating or inserting until the transaction is complete.