Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / WPF

Reflection Studio - Part 1 - Introduction: Architecture and Design

Rate me:
Please Sign up or sign in to vote.
4.83/5 (23 votes)
22 Sep 2010GPL36 min read 60.1K   6.9K   111  
Reflection Studio is a "developer" application for assembly, database, performance, and code generation, written in C# under WPF 4.0.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace ReflectionStudio.Core.Database.Schema
{
	public class IndexSchema : SchemaObjectBase
	{
		public IndexSchema(TableSchema table, string name, bool isPrimaryKey, bool isUnique, bool isClustered, List<string> memberColumns)
		{
			base._Database = table.Database;
			base._Name = name;
			_Table = table;
			_IsPrimaryKey = isPrimaryKey;
			_IsUnique = isUnique;
			_IsClustered = isClustered;
			_MemberColumns = new List<TableColumnSchema>();

			foreach (string str in memberColumns)
			{
				_MemberColumns.Add((TableColumnSchema)_Table.Columns.First(p => p.Name == str));
			}
		}

		public IndexSchema(TableSchema table, string name, bool isPrimaryKey, bool isUnique, bool isClustered, List<string> memberColumns, ExtendedProperty[] extendedProperties)
			: this(table, name, isPrimaryKey, isUnique, isClustered, memberColumns)
		{
			base._ExtendedProperties = new List<ExtendedProperty>(extendedProperties);
		}

		// Properties
		private bool _IsClustered;
		public bool IsClustered
		{
			get
			{
				return this._IsClustered;
			}
		}

		private bool _IsPrimaryKey;
		public bool IsPrimaryKey
		{
			get
			{
				return this._IsPrimaryKey;
			}
		}

		private bool _IsUnique;
		public bool IsUnique
		{
			get
			{
				return this._IsUnique;
			}
		}

		private List<TableColumnSchema> _MemberColumns;
		[Browsable(false)]
		public List<TableColumnSchema> MemberColumns
		{
			get
			{
				return this._MemberColumns;
			}
		}

		private TableSchema _Table;
		[Browsable(false)]
		public TableSchema Table
		{
			get
			{
				return this._Table;
			}
		}


		public override bool Equals(object obj)
		{
			IndexSchema schema = obj as IndexSchema;
			return (((schema != null) && schema.Table.Equals(this.Table)) && (schema.Name == this.Name));
		}

		public override int GetHashCode()
		{
			return (this.Table.GetHashCode() ^ this.Name.GetHashCode());
		}

		public override void Refresh()
		{
			this.Table.Refresh();
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Architect
France France
WPF and MVVM fan, I practice C # in all its forms from the beginning of the NET Framework without mentioning C ++ / MFC and other software packages such as databases, ASP, WCF, Web & Windows services, Application, and now Core and UWP.
In my wasted hours, I am guilty of having fathered C.B.R. and its cousins C.B.R. for WinRT and UWP on the Windows store.
But apart from that, I am a great handyman ... the house, a rocket stove to heat the jacuzzi and the last one: a wood oven for pizza, bread, and everything that goes inside

https://guillaumewaser.wordpress.com/
https://fouretcompagnie.wordpress.com/

Comments and Discussions