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.
CslaDataSourceConfiguration.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CslaDataSourceConfiguration.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>CslaDataSource configuration form.</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections;
10using System.Web.UI;
11using System.ComponentModel.Design;
12using System.Windows.Forms;
13
15{
19 public partial class CslaDataSourceConfiguration : Form
20 {
21 private DataSourceControl _control;
22
27 {
28 InitializeComponent();
29 }
30
36 public CslaDataSourceConfiguration(DataSourceControl control, string oldTypeName)
37 : this()
38 {
39 _control = control;
40 DiscoverTypes();
41 this.TypeComboBox.Text = oldTypeName;
42 }
43
47 public string TypeName
48 {
49 get { return this.TypeComboBox.Text; }
50 }
51
52 private void DiscoverTypes()
53 {
54 // try to get a reference to the type discovery service
55 ITypeDiscoveryService discovery = null;
56 if (_control.Site != null)
57 discovery = (ITypeDiscoveryService)_control.Site.GetService(typeof(ITypeDiscoveryService));
58
59 if (discovery != null)
60 {
61 // saves the cursor and sets the wait cursor
62 Cursor previousCursor = Cursor.Current;
63 Cursor.Current = Cursors.WaitCursor;
64 try
65 {
66 // gets all types using the type discovery service
67 ICollection types = discovery.GetTypes(typeof(object), true);
68 TypeComboBox.BeginUpdate();
69 TypeComboBox.Items.Clear();
70 // adds the types to the list
71 foreach (Type type in types)
72 {
73 if (type.Assembly.FullName.Substring(0, type.Assembly.FullName.IndexOf(",")) != "Csla" &&
74 typeof(Csla.Core.IBusinessObject).IsAssignableFrom(type))
75 {
76 string name = type.AssemblyQualifiedName;
77 if (name.Substring(name.Length - 19, 19) == "PublicKeyToken=null")
78 name = name.Substring(0, name.IndexOf(",", name.IndexOf(",") + 1));
79 TypeComboBox.Items.Add(name);
80 }
81 }
82 }
83 finally
84 {
85 Cursor.Current = previousCursor;
86 TypeComboBox.EndUpdate();
87 }
88 }
89 }
90 }
91}
CslaDataSourceConfiguration(DataSourceControl control, string oldTypeName)
Create instance of object.
string TypeName
Gets the type name entered by the user.
This is the core interface implemented by all CSLA .NET base classes.