adapdev-commits Mailing List for Adapdev.NET (Page 28)
Status: Beta
Brought to you by:
intesar66
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(26) |
Apr
(59) |
May
(37) |
Jun
(53) |
Jul
(13) |
Aug
(7) |
Sep
(5) |
Oct
(74) |
Nov
(404) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(10) |
Feb
(26) |
Mar
(64) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sean M. <int...@us...> - 2005-05-26 01:54:48
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31896/src/Adapdev.Cache Modified Files: Adapdev.Cache.csproj Log Message: Index: Adapdev.Cache.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/Adapdev.Cache.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Adapdev.Cache.csproj 25 May 2005 05:17:46 -0000 1.4 --- Adapdev.Cache.csproj 26 May 2005 01:54:39 -0000 1.5 *************** *** 90,98 **** HintPath = "..\..\lib\log4net.dll" /> - <Reference - Name = "Adapdev.Mock" - Project = "{7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> </References> </Build> --- 90,93 ---- |
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12019/src/Adapdev.Cache Removed Files: CacheMetaData.cs CacheMetaDataDictionary.cs CacheType.cs InMemoryCache.cs SerializedInMemoryCache.cs Log Message: --- CacheMetaDataDictionary.cs DELETED --- --- SerializedInMemoryCache.cs DELETED --- --- CacheMetaData.cs DELETED --- --- CacheType.cs DELETED --- --- InMemoryCache.cs DELETED --- |
From: Sean M. <int...@us...> - 2005-05-25 05:26:44
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/Scavengers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12019/src/Adapdev.Cache/Scavengers Removed Files: FixedExpirationScavenger.cs InactiveExpirationScavenger.cs LRUScavenger.cs Log Message: --- LRUScavenger.cs DELETED --- --- InactiveExpirationScavenger.cs DELETED --- --- FixedExpirationScavenger.cs DELETED --- |
From: Sean M. <int...@us...> - 2005-05-25 05:18:27
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Cache Modified Files: Adapdev.Cache.csproj CacheManager.cs CacheUtil.cs FileCache.cs ICache.cs Added Files: AbstractCache.cs CacheItem.cs CacheItemCollection.cs CacheItemDictionary.cs CacheItemEnumerator.cs ICacheItem.cs ImmutableInMemoryCache.cs MutableInMemoryCache.cs SerializedCacheItem.cs TypeKey.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: TypeKey.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for TypeKey. /// </summary> internal class TypeKey { public static string Build(Type t, string key) { return t.FullName + Separator + key; } public static string GetTypeName(string typekey) { return typekey.Substring(0, typekey.IndexOf(Separator)); } public static Type GetType(string typekey) { return Type.GetType(GetTypeName(typekey)); } public static string GetKey(string typekey) { return typekey.Substring(typekey.IndexOf(Separator), typekey.Length); } public static string Separator { get{return "---";} } } } --- NEW FILE: AbstractCache.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for AbstractCache. /// </summary> public abstract class AbstractCache : ICache { #region ICache Members public void Add(int key, object o) { this.Add(key.ToString(), o); } public void Remove(Type t, int key) { this.Remove(t, key.ToString()); } public object Get(Type t, int key) { return this.Get(t, key.ToString()); } public CacheItem GetCacheItem(Type t, int key) { return this.GetCacheItem(t, key.ToString()); } public bool Contains(Type t, int key) { return this.Contains(t, key.ToString()); } public void Scavenge(Adapdev.Cache.Scavengers.IScavenger scavenger) { scavenger.Scavenge(this); } public void Copy(ICache cache) { CacheUtil.Copy(cache, this); } public abstract void Add(string key, object o); public abstract void Clear(); public abstract bool Contains(Type t, string key); public abstract int Count{get;} public abstract CacheItem[] Entries{get;} public abstract object Get(Type t, string key); public abstract CacheItem GetCacheItem(Type t, string key); public abstract void Populate(); public abstract void Remove(Type t, string key); #endregion } } --- NEW FILE: CacheItem.cs --- using System; using Adapdev; namespace Adapdev.Cache { /// <summary> /// Summary description for CacheItem. /// </summary> /// [Serializable] public class CacheItem : ICacheItem { protected object _object = null; protected string _key = String.Empty; protected int _ordinal = 0; protected DateTime _created; protected Type _objectType = null; public CacheItem(string key, object o) { this._key = key; this._object = o; this._created = DateTime.Now; this._objectType = o.GetType(); } public DateTime Created { get{return this._created;} } public Type ObjectType { get{return this._objectType;} } public virtual object Object { get{return this._object;} } public string Key { get{return this._key;} } public string TypeKey { get{return Adapdev.Cache.TypeKey.Build(this.ObjectType, this.Key);} } public int Ordinal { get{return this._ordinal;} set{this._ordinal = value;} } public override string ToString() { return Adapdev.Text.StringUtil.ToString(this); } } } Index: CacheManager.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/CacheManager.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CacheManager.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- CacheManager.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,2 **** --- 1,4 ---- + using System; + namespace Adapdev.Cache { *************** *** 6,33 **** public class CacheManager { ! private static CacheManager instance = null; ! private static ICache cache = new SerializedInMemoryCache(); ! private static readonly object padlock = new object(); ! public static CacheManager GetInstance() { - lock (padlock) - { - if (instance == null) - instance = new CacheManager(); - return instance; - } } ! public ICache GetCache() { ! return cache; ! } ! public static void SetCache(CacheType type) ! { ! cache = CacheUtil.GetNewCache(type); } - } ! } \ No newline at end of file --- 8,33 ---- public class CacheManager { ! private static ICache _cache = new ImmutableInMemoryCache(); ! private CacheManager() { } ! public static ICache Cache { ! get ! { ! return _cache; ! } ! set ! { ! if(_cache != null) ! { ! _cache.Clear(); ! } ! _cache = value; ! } } } ! } Index: FileCache.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/FileCache.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** FileCache.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- FileCache.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,119 **** namespace Adapdev.Cache { - using System; - using System.IO; - using Adapdev.Serialization; - /// <summary> /// Summary description for FileCache. /// </summary> ! public class FileCache : ICache { ! private static string path = "FileCache/"; public FileCache() { ! SetUp(); } ! #region ICache Members ! public void Add(string id, object item) { ! CacheMetaData cmd = new CacheMetaData(); ! cmd.LastAccessed = DateTime.Now; ! cmd.ObjectId = id; ! cmd.ObjectType = item.GetType().AssemblyQualifiedName; ! Serializer.SerializeToBinary(cmd, path + id + ".cachemd"); ! Serializer.SerializeToBinary(item, path + id + ".cache"); } ! public void Remove(string id) { ! string f = path + id; ! if (File.Exists(f + ".cachemd")) ! { ! File.Delete(f + ".cachemd"); ! } ! if (File.Exists(f + ".cache")) ! { ! File.Delete(f + ".cache"); ! } } ! public object Get(string id) { ! CacheMetaData cmd = this.GetMetaData(id); ! if (cmd != null) ! { ! cmd.LastAccessed = DateTime.Now; ! return Serializer.DeserializeFromBinary(Type.GetType(cmd.ObjectType), path + id + ".cache"); ! } ! else ! { ! return null; ! } } ! public CacheMetaData GetMetaData(string id) { ! if (File.Exists(path + id + ".cachemd")) ! { ! return (CacheMetaData) Serializer.DeserializeFromBinary(typeof (CacheMetaData), path + id + ".cachemd"); ! } ! return null; } ! CacheMetaDataDictionary ICache.GetMetaData() { ! CacheMetaDataDictionary htmd = new CacheMetaDataDictionary(); ! foreach (string s in Directory.GetFileSystemEntries(path, ".cachemd")) { ! FileInfo f = new FileInfo(s); ! CacheMetaData cmd = this.GetMetaData(f.Name); ! htmd[f.Name] = cmd; } - - return htmd; } ! public void Clear() { ! Directory.Delete(path, true); ! SetUp(); } ! public int Count { ! get { return Directory.GetFiles(path).Length/2; } } ! public void SetScavenger(IScavenger scavenger) { ! // TODO: Add FileCache.SetScavenger implementation } ! public bool Contains(string id) { ! return File.Exists(path + id + ".cachemd"); } ! #endregion ! ! public static string Path { ! get { return path; } ! set { ! path = value; ! SetUp(); } } ! private static void SetUp() { ! Directory.CreateDirectory(path); } } ! } \ No newline at end of file --- 1,131 ---- + using System; + using System.Collections; + using System.IO; + using Adapdev.Serialization; + namespace Adapdev.Cache { /// <summary> /// Summary description for FileCache. /// </summary> ! public class FileCache : AbstractCache { ! private string _folderPath = String.Empty; ! private CacheItemDictionary _items = new CacheItemDictionary(); ! private static int _ordinal = 0; public FileCache() { ! this._folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "filecache"); ! if(!Directory.Exists(this._folderPath)) Directory.CreateDirectory(this._folderPath); ! ! FileCache._ordinal = this.Count; } ! public FileCache(string folderName) ! { ! this._folderPath = folderName; ! this._folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "filecache"); ! if(!Directory.Exists(this._folderPath)) Directory.CreateDirectory(this._folderPath); ! FileCache._ordinal = this.Count; ! } ! ! private string GetFileName(Type t, string key) { ! return TypeKey.Build(t, key) + ".cache"; ! } ! private string GetFullFileName(Type t, string key) ! { ! return Path.Combine(this._folderPath, this.GetFileName(t, key)); } ! private string GetFileNameWithoutExtension(string fileName) { ! return fileName.Substring(0, fileName.LastIndexOf(".")); } ! #region ICache Members ! ! public override void Add(string key, object o) { ! SerializedCacheItem c = new SerializedCacheItem(key, o); ! c.Ordinal = ++FileCache._ordinal; ! this._items[TypeKey.Build(o.GetType(), key)] = c; ! Serializer.SerializeToBinary(o, Path.Combine(this._folderPath, this.GetFileName(o.GetType(), key))); } ! public override void Remove(Type t, string key) { ! ! File.Delete(Path.Combine(this._folderPath, this.GetFileName(t, key))); ! this._items.Remove(TypeKey.Build(t, key)); } ! public override object Get(Type t, string key) { ! string typekey = TypeKey.Build(t, key); ! if(this._items.Contains(typekey)) { ! return (this._items[typekey] as SerializedCacheItem).Object; ! } ! else if(this.Contains(t, key)) ! { ! return Serializer.DeserializeFromBinary(t, this.GetFileName(t, key)); ! } ! else ! { ! return null; } } ! public override CacheItem GetCacheItem(Type t, string key) { ! return this._items[TypeKey.Build(t, key)] as SerializedCacheItem; } ! public override void Clear() { ! Directory.Delete(this._folderPath, true); ! Directory.CreateDirectory(this._folderPath); ! this._items.Clear(); } ! public override int Count { ! get ! { ! return Directory.GetFiles(this._folderPath).Length; ! } } ! public override bool Contains(Type t, string key) { ! return File.Exists(this.GetFullFileName(t, key)); } ! public override CacheItem[] Entries { ! get { ! CacheItem[] items = new CacheItem[this._items.Count]; ! this._items.Values.CopyTo(items, 0); ! return items; } } ! public override void Populate() { ! foreach(FileInfo f in new DirectoryInfo(this._folderPath).GetFiles()) ! { ! string fileName = this.GetFileNameWithoutExtension(f.Name); ! SerializedCacheItem c = new SerializedCacheItem(TypeKey.GetKey(fileName), Serializer.DeserializeFromBinary(TypeKey.GetType(fileName), f.FullName)); ! c.Ordinal = FileCache._ordinal++; ! this._items[f.Name] = c; ! } } + + #endregion } ! } --- NEW FILE: MutableInMemoryCache.cs --- using System; using System.Collections; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for ReadOnlyInMemoryCache. /// </summary> public class MutableInMemoryCache : AbstractCache { private CacheItemDictionary _hashtable = new CacheItemDictionary(); private int _ordinal = 0; public MutableInMemoryCache() { } #region ICache Members public override void Add(string key, object o) { CacheItem c = new CacheItem(key, o); c.Ordinal = ++this._ordinal; this._hashtable[TypeKey.Build(o.GetType(), key)] = c; } public override void Remove(Type t, string key) { this._hashtable.Remove(TypeKey.Build(t, key)); } public override object Get(Type t, string key) { return (this._hashtable[TypeKey.Build(t, key)] as CacheItem).Object; } public override CacheItem GetCacheItem(Type t, string key) { return this._hashtable[TypeKey.Build(t, key)] as CacheItem; } public override void Clear() { this._hashtable.Clear(); } public override bool Contains(Type t, string key) { return this._hashtable.Contains(TypeKey.Build(t, key)); } public override int Count { get { return this._hashtable.Count; } } public override CacheItem[] Entries { get { CacheItem[] items = new CacheItem[this._hashtable.Count]; this._hashtable.Values.CopyTo(items, 0); return items; } } public override void Populate() { } #endregion } } Index: Adapdev.Cache.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/Adapdev.Cache.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Adapdev.Cache.csproj 14 Apr 2005 03:32:03 -0000 1.3 --- Adapdev.Cache.csproj 25 May 2005 05:17:46 -0000 1.4 *************** *** 90,93 **** --- 90,98 ---- HintPath = "..\..\lib\log4net.dll" /> + <Reference + Name = "Adapdev.Mock" + Project = "{7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 95,98 **** --- 100,108 ---- <Include> <File + RelPath = "AbstractCache.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "AdapdevAssemblyInfo.cs" Link = "..\AdapdevAssemblyInfo.cs" *************** *** 101,120 **** /> <File ! RelPath = "CacheManager.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheMetaData.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheMetaDataDictionary.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheType.cs" SubType = "Code" BuildAction = "Compile" --- 111,135 ---- /> <File ! RelPath = "CacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheItemCollection.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheItemDictionary.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "CacheItemEnumerator.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "CacheManager.cs" SubType = "Code" BuildAction = "Compile" *************** *** 136,165 **** /> <File ! RelPath = "ICacheStats.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "InMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "SerializedInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "SqlServerCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Scavengers\FixedExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Scavengers\InactiveExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" --- 151,185 ---- /> <File ! RelPath = "ICacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "ImmutableInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "MutableInMemoryCache.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "SerializedCacheItem.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "TypeKey.cs" SubType = "Code" BuildAction = "Compile" /> <File ! RelPath = "Scavengers\AbsoluteExpirationScavenger.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "Scavengers\GreaterThanOrdinalScavenger.cs" SubType = "Code" BuildAction = "Compile" *************** *** 171,175 **** /> <File ! RelPath = "Scavengers\LRUScavenger.cs" SubType = "Code" BuildAction = "Compile" --- 191,200 ---- /> <File ! RelPath = "Scavengers\LIFONumberScavenger.cs" ! SubType = "Code" ! BuildAction = "Compile" ! /> ! <File ! RelPath = "Scavengers\SlidingExpirationScavenger.cs" SubType = "Code" BuildAction = "Compile" --- NEW FILE: SerializedCacheItem.cs --- using System; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for SerializedCacheItem. /// </summary> public class SerializedCacheItem : CacheItem { public SerializedCacheItem(string key, object o) : base(key, o) { this._key = key; this._object = Serializer.SerializeToBinary(o); this._created = DateTime.Now; this._objectType = o.GetType(); } public override object Object { get { return Serializer.DeserializeFromBinary(this._objectType, this._object as byte[]); } } public byte[] BinaryObject { get{return this._object as byte[];} } } } --- NEW FILE: CacheItemCollection.cs --- /****************************************** * Auto-generated by Codus * 4/20/2005 11:18:21 AM ******************************************/ using System; using System.Collections; namespace Adapdev.Cache { [Serializable()] public class CacheItemCollection : CollectionBase { public CacheItemCollection() { } public CacheItemCollection(IList value) { this.AddRange(value); } public CacheItemCollection(CacheItem[] value) { this.AddRange(value); } public CacheItem this[int index] { get { return ((CacheItem)(List[index])); } set { List[index] = value; } } public int Add(CacheItem value) { return List.Add(value); } public void AddRange(CacheItem[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } } public void AddRange(IList value) { for (int i = 0; (i < value.Count); i = (i + 1)) { this.Add((CacheItem)value[i]); } } public bool Contains(CacheItem value) { return List.Contains(value); } public void CopyTo(CacheItem[] array, int index) { List.CopyTo(array, index); } public int IndexOf(CacheItem value) { return List.IndexOf(value); } public void Insert(int index, CacheItem value) { List.Insert(index, value); } public new CacheItemEnumerator GetEnumerator() { return new CacheItemEnumerator(this); } public void Remove(CacheItem value) { List.Remove(value); } } } Index: CacheUtil.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/CacheUtil.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CacheUtil.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- CacheUtil.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,6 **** namespace Adapdev.Cache { - using System; - /// <summary> /// Summary description for CacheUtil. --- 1,6 ---- + using System; + namespace Adapdev.Cache { /// <summary> /// Summary description for CacheUtil. *************** *** 8,27 **** public class CacheUtil { ! public static ICache GetNewCache(CacheType type) { ! switch (type) { ! case CacheType.IN_MEMORY: ! return new InMemoryCache(); ! case CacheType.SERIALIZED_IN_MEMORY: ! return new SerializedInMemoryCache(); ! case CacheType.SQLSERVER: ! return new SqlServerCache(); ! case CacheType.FILE: ! return new FileCache(); ! default: ! throw new NotImplementedException("CacheType " + type + " is not supported."); } } } ! } \ No newline at end of file --- 8,20 ---- public class CacheUtil { ! private CacheUtil(){} ! ! public static void Copy(ICache source, ICache target) { ! foreach(CacheItem item in source.Entries) { ! target.Add(item.Key, item.Object); } } } ! } --- NEW FILE: CacheItemEnumerator.cs --- /****************************************** * Auto-generated by Codus * 4/20/2005 11:18:21 AM ******************************************/ using System; using System.Collections; namespace Adapdev.Cache { public class CacheItemEnumerator : IEnumerator { private IEnumerator baseEnumerator; private IEnumerable temp; public CacheItemEnumerator(CacheItemCollection mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); } public CacheItemEnumerator(CacheItemDictionary mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); } public CacheItem Current { get { return ((CacheItem)(baseEnumerator.Current)); } } object IEnumerator.Current { get { return baseEnumerator.Current; } } public bool MoveNext() { return baseEnumerator.MoveNext(); } bool IEnumerator.MoveNext() { return baseEnumerator.MoveNext(); } public void Reset() { baseEnumerator.Reset(); } void IEnumerator.Reset() { baseEnumerator.Reset(); } } } Index: ICache.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/ICache.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ICache.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- ICache.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,2 **** --- 1,6 ---- + using System; + using System.Collections; + using Adapdev.Cache.Scavengers; + namespace Adapdev.Cache { *************** *** 6,18 **** public interface ICache { ! void Add(string id, object item); ! void Remove(string id); ! object Get(string id); ! CacheMetaData GetMetaData(string id); ! CacheMetaDataDictionary GetMetaData(); void Clear(); ! int Count { get; } ! void SetScavenger(IScavenger scavenger); ! bool Contains(string id); } ! } \ No newline at end of file --- 10,29 ---- public interface ICache { ! void Add(string key, object o); ! void Add(int key, object o); ! void Remove(Type t, int key); ! void Remove(Type t, string key); ! object Get(Type t, int key); ! object Get(Type t, string key); ! CacheItem GetCacheItem(Type t, string key); ! CacheItem GetCacheItem(Type t, int key); void Clear(); ! int Count{get;} ! bool Contains(Type t, string key); ! bool Contains(Type t, int key); ! void Scavenge(IScavenger scavenger); ! CacheItem[] Entries{get;} ! void Populate(); ! void Copy(ICache cache); } ! } --- NEW FILE: ImmutableInMemoryCache.cs --- using System; using System.Collections; using Adapdev.Serialization; namespace Adapdev.Cache { /// <summary> /// Summary description for ReadOnlyInMemoryCache. /// </summary> public class ImmutableInMemoryCache : AbstractCache { private CacheItemDictionary _hashtable = new CacheItemDictionary(); private int _ordinal = 0; public ImmutableInMemoryCache() { } #region ICache Members public override void Add(string key, object o) { SerializedCacheItem c = new SerializedCacheItem(key, o); c.Ordinal = ++this._ordinal; this._hashtable[TypeKey.Build(o.GetType(), key)] = c; } public override void Remove(Type t, string key) { this._hashtable.Remove(TypeKey.Build(t, key)); } public override object Get(Type t, string key) { return (this._hashtable[TypeKey.Build(t, key)] as CacheItem).Object; } public override CacheItem GetCacheItem(Type t, string key) { return this._hashtable[TypeKey.Build(t, key)] as CacheItem; } public override void Clear() { this._hashtable.Clear(); } public override bool Contains(Type t, string key) { return this._hashtable.Contains(TypeKey.Build(t, key)); } public override int Count { get { return this._hashtable.Count; } } public override CacheItem[] Entries { get { CacheItem[] items = new CacheItem[this._hashtable.Count]; this._hashtable.Values.CopyTo(items, 0); return items; } } public override void Populate() { } #endregion } } --- NEW FILE: ICacheItem.cs --- using System; namespace Adapdev.Cache { /// <summary> /// Summary description for ICacheItem. /// </summary> public interface ICacheItem { DateTime Created{get;} Type ObjectType{get;} object Object{get;} string Key{get;} int Ordinal{get;set;} } } --- NEW FILE: CacheItemDictionary.cs --- using System; using System.Collections; namespace Adapdev.Cache { public class CacheItemDictionary : DictionaryBase { public CacheItem this[ object key ] { get { return( (CacheItem) Dictionary[key] ); } set { Dictionary[key] = value; } } public ICollection Keys { get { return( Dictionary.Keys ); } } public ICollection Values { get { return( Dictionary.Values ); } } public void Add( String key, String value ) { Dictionary.Add( key, value ); } public bool Contains( String key ) { return( Dictionary.Contains( key ) ); } public void Remove( String key ) { Dictionary.Remove( key ); } } } |
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/Scavengers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Cache/Scavengers Modified Files: IScavenger.cs Added Files: AbsoluteExpirationScavenger.cs GreaterThanOrdinalScavenger.cs LIFONumberScavenger.cs SlidingExpirationScavenger.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation Index: IScavenger.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache/Scavengers/IScavenger.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** IScavenger.cs 28 Feb 2005 01:31:43 -0000 1.1.1.1 --- IScavenger.cs 25 May 2005 05:17:46 -0000 1.2 *************** *** 1,3 **** ! namespace Adapdev.Cache { /// <summary> --- 1,5 ---- ! using System; ! ! namespace Adapdev.Cache.Scavengers { /// <summary> *************** *** 6,11 **** public interface IScavenger { ! void Execute(); ! int Frequency { get; set; } } ! } \ No newline at end of file --- 8,12 ---- public interface IScavenger { ! void Scavenge(ICache cache); } ! } --- NEW FILE: LIFONumberScavenger.cs --- using System; namespace Adapdev.Cache.Scavengers { /// <summary> /// Summary description for LIFOScavenger. /// </summary> public class LIFONumberScavenger : IScavenger { private int _num = 0; private LIFONumberScavenger(){} public LIFONumberScavenger(int numberOfItems) { this._num = numberOfItems; } #region IScavenger Members public void Scavenge(ICache cache) { CacheItem[] entries = cache.Entries; for(int i = entries.Length; i>= _num; i--) { CacheItem c = entries[i] as CacheItem; cache.Remove(c.ObjectType, c.Key); } } #endregion } } --- NEW FILE: SlidingExpirationScavenger.cs --- using System; namespace Adapdev.Cache.Scavengers { /// <summary> /// Summary description for DateScavenger. /// </summary> public class SlidingExpirationScavenger : IScavenger { private TimeSpan _timespan; private SlidingExpirationScavenger(){} public SlidingExpirationScavenger(TimeSpan timespan) { this._timespan = timespan; } #region IScavenger Members public void Scavenge(ICache cache) { DateTime span = DateTime.Now.Subtract(this._timespan); foreach(CacheItem item in cache.Entries) { if(item.Created < span) cache.Remove(item.ObjectType, item.Key); } } #endregion } } --- NEW FILE: AbsoluteExpirationScavenger.cs --- using System; namespace Adapdev.Cache.Scavengers { /// <summary> /// Summary description for DateScavenger. /// </summary> public class AbsoluteExpirationScavenger : IScavenger { private DateTime _date; private AbsoluteExpirationScavenger(){} public AbsoluteExpirationScavenger(DateTime dateTime) { this._date = dateTime; } #region IScavenger Members public void Scavenge(ICache cache) { foreach(CacheItem item in cache.Entries) { if(item.Created < this._date) cache.Remove(item.ObjectType, item.Key); } } #endregion } } --- NEW FILE: GreaterThanOrdinalScavenger.cs --- using System; namespace Adapdev.Cache.Scavengers { /// <summary> /// Summary description for GreaterThanOrdinalScavenger. /// </summary> public class GreaterThanOrdinalScavenger : IScavenger { private int _greaterThan = 0; private GreaterThanOrdinalScavenger(){} public GreaterThanOrdinalScavenger(int greaterThan) { _greaterThan = greaterThan; } #region IScavenger Members public void Scavenge(ICache cache) { foreach(CacheItem c in cache.Entries) { if(c.Ordinal > this._greaterThan) { cache.Remove(c.ObjectType, c.Key); } } } #endregion } } |
From: Sean M. <int...@us...> - 2005-05-25 05:18:27
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Data Modified Files: Adapdev.Data.csproj Added Files: DataReaderDebugger.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: DataReaderDebugger.cs --- using System; using System.Data; using System.Text; namespace Adapdev.Data { /// <summary> /// Summary description for DataReaderDebugger. /// </summary> public class DataReaderDebugger { private IDataReader _reader = null; public DataReaderDebugger(IDataReader reader) { this._reader = reader; } public string Text { get { StringBuilder sb = new StringBuilder(); do { int i = _reader.FieldCount; for(int j = 0; j < i; j++) { sb.Append(this._reader.GetName(j) + "|"); } sb.Append(Environment.NewLine); while(this._reader.Read()) { for(int j = 0; j < i; j++) { sb.Append(this._reader.GetValue(j).ToString() + "|"); } sb.Append(Environment.NewLine); } sb.Append(Environment.NewLine); } while(this._reader.NextResult()); return sb.ToString(); } } } } Index: Adapdev.Data.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Adapdev.Data.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Adapdev.Data.csproj 14 Apr 2005 03:32:04 -0000 1.6 --- Adapdev.Data.csproj 25 May 2005 05:17:47 -0000 1.7 *************** *** 131,134 **** --- 131,139 ---- /> <File + RelPath = "DataReaderDebugger.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "DataSetDebugger.cs" SubType = "Code" |
From: Sean M. <int...@us...> - 2005-05-25 05:18:26
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Cache.Tests Modified Files: Adapdev.Cache.Tests.csproj Added Files: AbstractICacheTest.cs CacheManagerTest.cs CacheUtilTest.cs FileCacheTest.cs ImmutableInMemoryCache.cs MutableInMemoryCacheTest.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: AbstractICacheTest.cs --- using System; using NUnit.Framework; using Adapdev.Cache; using Adapdev.Mock; namespace Adapdev.Tests.Cache { /// <summary> /// Summary description for MutableInMemoryCache. /// </summary> /// public abstract class AbstractICacheTest { protected ICache cache = null; public abstract ICache GetCache(); [SetUp] public void Setup() { this.cache = this.GetCache(); } [TearDown] public void TearDown() { cache.Clear(); cache = null; } [Test] public void Add() { SuppliersEntity e = new SuppliersEntity(); e.SupplierID = 12; cache.Add(12, e); Assert.IsTrue(cache.Count == 1, "Cache count should be 1."); } [Test] public void Get() { SuppliersEntity e = new SuppliersEntity(); e.SupplierID = 12; e.ContactName = "Joe Schmoe"; cache.Add(12, e); Assert.IsTrue(cache.Count == 1, "Cache count should be 1."); Assert.AreEqual(e.ContactName, (cache.Get(typeof(SuppliersEntity), 12) as SuppliersEntity).ContactName); } [Test] public void Clear() { SuppliersEntity e = new SuppliersEntity(); e.SupplierID = 12; cache.Add(12, e); Assert.IsTrue(cache.Count == 1, "Cache count should be 1."); cache.Clear(); Assert.IsTrue(cache.Count == 0, "Cache count should be 0."); } [Test] public void Remove() { SuppliersEntity e = new SuppliersEntity(); e.SupplierID = 12; cache.Add(12, e); Assert.IsTrue(cache.Count == 1, "Cache count should be 1."); cache.Remove(e.GetType(), e.SupplierID); Assert.IsTrue(cache.Count == 0, "Cache count should be 0."); } [Test] public void Entries() { SuppliersEntity e1 = new SuppliersEntity(); e1.SupplierID = 12; SuppliersEntity e2 = new SuppliersEntity(); e2.SupplierID = 13; cache.Add(e1.SupplierID, e1); cache.Add(e2.SupplierID, e2); Assert.IsTrue(cache.Count == 2, "Cache count should be 2."); int i = 0; foreach(CacheItem c in cache.Entries) { i++; Assert.IsNotNull(c.Object); } Assert.AreEqual(cache.Count, i); } [Test] public void Ordinal() { SuppliersEntity e1 = new SuppliersEntity(); e1.SupplierID = 12; SuppliersEntity e2 = new SuppliersEntity(); e2.SupplierID = 13; cache.Add(e1.SupplierID, e1); cache.Add(e2.SupplierID, e2); Assert.IsTrue(cache.Count == 2, "Cache count should be 2."); CacheItem c1 = cache.GetCacheItem(typeof(SuppliersEntity), e1.SupplierID); CacheItem c2 = cache.GetCacheItem(typeof(SuppliersEntity), e2.SupplierID); Assert.IsTrue(c1.Ordinal != c2.Ordinal, "Ordinals should be different."); Assert.IsTrue(c2.Ordinal == c1.Ordinal + 1, "Ordinals should only be 1 number apart."); } [Test] public void Contains() { SuppliersEntity e1 = new SuppliersEntity(); e1.SupplierID = 12; cache.Add(e1.SupplierID, e1); Assert.IsTrue(cache.Contains(e1.GetType(), e1.SupplierID), "Cache should return true for .Contains"); } [Test] public void CacheItem() { SuppliersEntity e1 = new SuppliersEntity(); e1.SupplierID = 12; cache.Add(e1.SupplierID, e1); CacheItem c = cache.GetCacheItem(e1.GetType(), e1.SupplierID); Assert.AreEqual(e1.GetType(), c.ObjectType, "Object Types aren't equal."); Assert.AreEqual(1, c.Ordinal, "Ordinal should be 1"); Assert.AreEqual(e1.SupplierID.ToString(), c.Key, "Keys are not equal."); Console.WriteLine(c); } [Test] public void Copy() { ICache source = this.GetCache(); this.cache.Add(1, new SuppliersEntity()); source.Add(2, new SuppliersEntity()); Assert.AreEqual(1, this.cache.Count); Assert.AreEqual(1, source.Count); this.cache.Copy(source); Assert.AreEqual(2, this.cache.Count); } } } --- NEW FILE: CacheManagerTest.cs --- using System; using NUnit.Framework; using Adapdev.Cache; using Adapdev.Mock; namespace Adapdev.Tests.Cache { /// <summary> /// Summary description for CacheManagerTest. /// </summary> /// [TestFixture] public class CacheManagerTest { [Test] public void Cache() { Assert.AreEqual(typeof(ImmutableInMemoryCache), CacheManager.Cache.GetType()); CacheManager.Cache.Add(1, new SuppliersEntity()); Assert.AreEqual(1, CacheManager.Cache.Count); CacheManager.Cache = new MutableInMemoryCache(); Assert.AreEqual(0, CacheManager.Cache.Count, "Cache has switched, so count should be 0."); } } } --- NEW FILE: MutableInMemoryCacheTest.cs --- using System; using NUnit.Framework; using Adapdev.Cache; using Adapdev.Mock; namespace Adapdev.Tests.Cache { /// <summary> /// Summary description for MutableInMemoryCache. /// </summary> /// [TestFixture] public class MutableInMemoryCacheTest : AbstractICacheTest { public override ICache GetCache() { return new MutableInMemoryCache(); } [Test] public void Mutable() { SuppliersEntity e1 = new SuppliersEntity(); e1.SupplierID = 12; cache.Add(e1.SupplierID, e1); SuppliersEntity e2 = cache.Get(typeof(SuppliersEntity), 12) as SuppliersEntity; e2.SupplierID = 13; Assert.IsTrue(cache.Contains(e1.GetType(), 12), "Cache key should not change."); SuppliersEntity e3 = cache.Get(typeof(SuppliersEntity), 12) as SuppliersEntity; Assert.AreEqual(13, e3.SupplierID, "Object in cache should have been updated."); } } } Index: Adapdev.Cache.Tests.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Cache.Tests/Adapdev.Cache.Tests.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Adapdev.Cache.Tests.csproj 14 Apr 2005 03:32:02 -0000 1.3 --- Adapdev.Cache.Tests.csproj 25 May 2005 05:17:46 -0000 1.4 *************** *** 95,98 **** --- 95,103 ---- HintPath = "..\..\lib\log4net.dll" /> + <Reference + Name = "Adapdev" + Project = "{CC30A321-2569-4B1F-8E1A-781B5509B56D}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 100,103 **** --- 105,113 ---- <Include> <File + RelPath = "AbstractICacheTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "AdapdevAssemblyInfo.cs" Link = "..\AdapdevAssemblyInfo.cs" *************** *** 105,108 **** --- 115,163 ---- BuildAction = "Compile" /> + <File + RelPath = "CacheManagerTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "CacheUtilTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "FileCacheTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ImmutableInMemoryCache.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "MutableInMemoryCacheTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Scavengers\AbsoluteExpirationScavengerTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Scavengers\BaseScavengerTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Scavengers\GreaterThanOrdinalScavengerTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Scavengers\SlidingExpirationScavengerTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> --- NEW FILE: FileCacheTest.cs --- using System; using NUnit.Framework; using Adapdev.Cache; using Adapdev.Mock; namespace Adapdev.Tests.Cache { /// <summary> /// Summary description for MutableInMemoryCache. /// </summary> /// [TestFixture] public class FileCacheTest : AbstractICacheTest { public override ICache GetCache() { return new FileCache(); } [Test] public void Immutable() { SuppliersEntity e1 = new SuppliersEntity(); e1.SupplierID = 12; cache.Add(e1.SupplierID, e1); SuppliersEntity e2 = cache.Get(typeof(SuppliersEntity), 12) as SuppliersEntity; e2.SupplierID = 13; Assert.IsTrue(cache.Contains(e1.GetType(), 12), "Cache key should not change."); SuppliersEntity e3 = cache.Get(typeof(SuppliersEntity), 12) as SuppliersEntity; Assert.IsFalse(13 == e3.SupplierID, "Object in cache should NOT have been updated."); } } } --- NEW FILE: ImmutableInMemoryCache.cs --- using System; using NUnit.Framework; using Adapdev.Cache; using Adapdev.Mock; namespace Adapdev.Tests.Cache { /// <summary> /// Summary description for MutableInMemoryCache. /// </summary> /// [TestFixture] public class ImmutableInMemoryCacheTest : AbstractICacheTest { public override ICache GetCache() { return new ImmutableInMemoryCache(); } [Test] public void Immutable() { SuppliersEntity e1 = new SuppliersEntity(); e1.SupplierID = 12; cache.Add(e1.SupplierID, e1); SuppliersEntity e2 = cache.Get(typeof(SuppliersEntity), 12) as SuppliersEntity; e2.SupplierID = 13; Assert.IsTrue(cache.Contains(e1.GetType(), 12), "Cache key should not change."); SuppliersEntity e3 = cache.Get(typeof(SuppliersEntity), 12) as SuppliersEntity; Assert.IsFalse(13 == e3.SupplierID, "Object in cache should NOT have been updated."); } } } --- NEW FILE: CacheUtilTest.cs --- using System; using NUnit.Framework; using Adapdev.Cache; using Adapdev.Mock; namespace Adapdev.Tests.Cache { /// <summary> /// Summary description for CacheManagerTest. /// </summary> /// [TestFixture] public class CacheUtilTest { [Test] public void Copy() { ICache source = new MutableInMemoryCache(); ICache target = new FileCache(); for(int i = 0; i < 100; i++) { source.Add(i, new SuppliersEntity()); } CacheUtil.Copy(source, target); Assert.AreEqual(100, source.Count); Assert.AreEqual(100, target.Count, "Cache items were not copied over."); } } } |
From: Sean M. <int...@us...> - 2005-05-25 05:17:59
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev/Reflection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev/Reflection Added Files: ClassAccessor.cs ClassAccessorCache.cs FieldAccessor.cs FieldAccessorException.cs IValueAccessor.cs PropertyAccessor.cs PropertyAccessorException.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: ClassAccessorCache.cs --- using System; using System.Collections; using System.Text; namespace Adapdev.Reflection { /// <summary> /// Summary description for ClassAccessorCache. /// </summary> public class ClassAccessorCache { private static Hashtable _classes = new Hashtable(); private ClassAccessorCache() { } public static ClassAccessor Get(Type t) { ClassAccessor c = null; if(!_classes.ContainsKey(t.FullName)) { c = new ClassAccessor(t); Add(c); c.LoadAllProperties(); } else { c = _classes[t.FullName] as ClassAccessor; } return c; } public static ClassAccessor Get(object o) { return Get(o.GetType()); } public static void Add(ClassAccessor c) { _classes[c.Type.FullName] = c; } public static void Remove(Type t) { _classes.Remove(t.FullName); } public static void Clear() { _classes.Clear(); } public static int Count { get{return _classes.Count;} } public static string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Properties for ClassAccessorCache: " + Environment.NewLine); foreach(ClassAccessor c in _classes.Values) { sb.Append(c + Environment.NewLine); } return sb.ToString(); } } } --- NEW FILE: ClassAccessor.cs --- using System; using System.Collections; using System.Reflection; using System.Text; namespace Adapdev.Reflection { /// <summary> /// Summary description for ClassAccessor. /// </summary> public class ClassAccessor { private Type _type = null; private Hashtable _properties = new Hashtable(); private DateTime _created; public ClassAccessor(Type t) { this._type = t; this._created = DateTime.Now; } public ClassAccessor(object o) : this(o.GetType()){} public void AddProperty(string name) { PropertyAccessor accessor = new PropertyAccessor(this._type, name); this._properties[name] = accessor; } public object GetPropertyValue(object o, string propertyName) { this.CheckForAccessor(propertyName); PropertyAccessor accessor = this._properties[propertyName] as PropertyAccessor; return accessor.Get(o); } public PropertyAccessor GetPropertyAccessor(string propertyName) { return this._properties[propertyName] as PropertyAccessor; } public Hashtable GetPropertyAccessors() { return this._properties; } public Type PropertyType(string propertyName) { this.CheckForAccessor(propertyName); PropertyAccessor accessor = this._properties[propertyName] as PropertyAccessor; return accessor.PropertyType; } public Type Type { get { return this._type; } } public void SetPropertyValue(object o, string propertyName, object val) { this.CheckForAccessor(propertyName); PropertyAccessor accessor = this._properties[propertyName] as PropertyAccessor; accessor.Set(o, val); } private void CheckForAccessor(string propertyName) { if(!this.IsPropertyDefined(propertyName)) this.AddProperty(propertyName); } private bool IsPropertyDefined(string propertyName) { return this._properties.ContainsKey(propertyName); } public void LoadAllProperties() { PropertyInfo[] infoArray = this._type.GetProperties(); foreach(PropertyInfo p in infoArray) { this.AddProperty(p.Name); } } public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("[" + this._type.FullName + "] Properties loaded: " + Environment.NewLine); foreach(string key in this._properties.Keys) { sb.Append(key + Environment.NewLine); } return sb.ToString(); } public int PropertyCount { get{return this._properties.Count;} } } } --- NEW FILE: FieldAccessor.cs --- // // Author: James Nies // Date: 3/22/2005 // Description: The PropertyAccessor class provides fast dynamic access // to a property of a specified target class. // // *** This code was written by James Nies and has been provided to you, *** // *** free of charge, for your use. I assume no responsibility for any *** // *** undesired events resulting from the use of this code or the *** // *** information that has been provided with it . *** // using System; using System.Reflection; using System.Reflection.Emit; using System.Threading; using System.Collections; namespace Adapdev.Reflection { /// <summary> /// The PropertyAccessor class provides fast dynamic access /// to a property of a specified target class. /// </summary> public class FieldAccessor : IValueAccessor { /// <summary> /// Creates a new property accessor. /// </summary> /// <param name="targetType">Target object type.</param> /// <param name="field">Property name.</param> public FieldAccessor(Type targetType, string field) { this.mTargetType = targetType; this.mField = field; FieldInfo fieldInfo = targetType.GetField(field, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); // // Make sure the property exists // if(fieldInfo == null) { throw new FieldAccessorException( string.Format("Field \"{0}\" does not exist for type " + "{1}.", field, targetType)); } else { this.mCanRead = true; this.mCanWrite = true; //!fieldInfo.IsInitOnly; this.mFieldType = fieldInfo.FieldType; this.fi = fieldInfo; } } /// <summary> /// Gets the property value from the specified target. /// </summary> /// <param name="target">Target object.</param> /// <returns>Property value.</returns> public object Get(object target) { if(mCanRead) { if(this.mEmittedValueAccessor == null) { this.Init(); } return this.mEmittedValueAccessor.Get(target); } else { throw new FieldAccessorException( string.Format("Field \"{0}\" does not have a get method.", mField)); } } /// <summary> /// Sets the property for the specified target. /// </summary> /// <param name="target">Target object.</param> /// <param name="value">Value to set.</param> public void Set(object target, object value) { if(mCanWrite) { if(this.mEmittedValueAccessor == null) { this.Init(); } // // Set the property value // this.mEmittedValueAccessor.Set(target, value); } else { throw new FieldAccessorException( string.Format("Field \"{0}\" does not have a set method.", mField)); } } /// <summary> /// Whether or not the Property supports read access. /// </summary> public bool CanRead { get { return this.mCanRead; } } /// <summary> /// Whether or not the Property supports write access. /// </summary> public bool CanWrite { get { return this.mCanWrite; } } /// <summary> /// The Type of object this property accessor was /// created for. /// </summary> public Type TargetType { get { return this.mTargetType; } } /// <summary> /// The Type of the Property being accessed. /// </summary> public Type FieldType { get { return this.mFieldType; } } private Type mTargetType; private string mField; private Type mFieldType; private IValueAccessor mEmittedValueAccessor; private Hashtable mTypeHash; private bool mCanRead; private bool mCanWrite; private FieldInfo fi; /// <summary> /// This method generates creates a new assembly containing /// the Type that will provide dynamic access. /// </summary> private void Init() { this.InitTypes(); // Create the assembly and an instance of the // property accessor class. Assembly assembly = EmitAssembly(); mEmittedValueAccessor = assembly.CreateInstance("Field") as IValueAccessor; if(mEmittedValueAccessor == null) { throw new Exception("Unable to create property accessor."); } } /// <summary> /// Thanks to Ben Ratzlaff for this snippet of code /// http://www.codeproject.com/cs/miscctrl/CustomPropGrid.asp /// /// "Initialize a private hashtable with type-opCode pairs /// so i dont have to write a long if/else statement when outputting msil" /// </summary> private void InitTypes() { mTypeHash=new Hashtable(); mTypeHash[typeof(sbyte)]=OpCodes.Ldind_I1; mTypeHash[typeof(byte)]=OpCodes.Ldind_U1; mTypeHash[typeof(char)]=OpCodes.Ldind_U2; mTypeHash[typeof(short)]=OpCodes.Ldind_I2; mTypeHash[typeof(ushort)]=OpCodes.Ldind_U2; mTypeHash[typeof(int)]=OpCodes.Ldind_I4; mTypeHash[typeof(uint)]=OpCodes.Ldind_U4; mTypeHash[typeof(long)]=OpCodes.Ldind_I8; mTypeHash[typeof(ulong)]=OpCodes.Ldind_I8; mTypeHash[typeof(bool)]=OpCodes.Ldind_I1; mTypeHash[typeof(double)]=OpCodes.Ldind_R8; mTypeHash[typeof(float)]=OpCodes.Ldind_R4; } /// <summary> /// Create an assembly that will provide the get and set methods. /// </summary> private Assembly EmitAssembly() { // // Create an assembly name // AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "FieldAccessorAssembly"; // // Create a new assembly with one module // AssemblyBuilder newAssembly = Thread.GetDomain().DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run); ModuleBuilder newModule = newAssembly.DefineDynamicModule("Module"); // // Define a public class named "Property" in the assembly. // TypeBuilder myType = newModule.DefineType("Field", TypeAttributes.Public); // // Mark the class as implementing IPropertyAccessor. // myType.AddInterfaceImplementation(typeof(IValueAccessor)); // Add a constructor ConstructorBuilder constructor = myType.DefineDefaultConstructor(MethodAttributes.Public); // // Define a method for the get operation. // Type[] getParamTypes = new Type[] {typeof(object)}; Type getReturnType = typeof(object); MethodBuilder getMethod = myType.DefineMethod("Get", MethodAttributes.Public | MethodAttributes.Virtual, getReturnType, getParamTypes); // // From the method, get an ILGenerator. This is used to // emit the IL that we want. // ILGenerator getIL = getMethod.GetILGenerator(); // // Emit the IL. // // MethodInfo targetGetMethod = this.mTargetType.GetMethod("get_" + this.mField); // // if(targetGetMethod != null) // { // TODO: Fix this piece getIL.DeclareLocal(typeof(object)); getIL.Emit(OpCodes.Ldarg_1); //Load the first argument //(target object) getIL.Emit(OpCodes.Castclass, this.mTargetType); //Cast to the source type getIL.Emit(OpCodes.Stfld, this.mField); //getIL.EmitCall(OpCodes.Call, targetGetMethod, null); //Get the property value // if(targetGetMethod.ReturnType.IsValueType) // { // getIL.Emit(OpCodes.Box, targetGetMethod.ReturnType); //Box if necessary // } getIL.Emit(OpCodes.Stloc_0); //Store it getIL.Emit(OpCodes.Ldloc_0); // } // else // { // getIL.ThrowException(typeof(MissingMethodException)); // } getIL.Emit(OpCodes.Ret); // // Define a method for the set operation. // Type[] setParamTypes = new Type[] {typeof(object), typeof(object)}; Type setReturnType = null; MethodBuilder setMethod = myType.DefineMethod("Set", MethodAttributes.Public | MethodAttributes.Virtual, setReturnType, setParamTypes); // // From the method, get an ILGenerator. This is used to // emit the IL that we want. // ILGenerator setIL = setMethod.GetILGenerator(); // // Emit the IL. // MethodInfo targetSetMethod = this.mTargetType.GetMethod("set_" + this.mField); if(targetSetMethod != null) { Type paramType = targetSetMethod.GetParameters()[0].ParameterType; setIL.DeclareLocal(paramType); setIL.Emit(OpCodes.Ldarg_1); //Load the first argument //(target object) setIL.Emit(OpCodes.Castclass, this.mTargetType); //Cast to the source type setIL.Emit(OpCodes.Ldarg_2); //Load the second argument //(value object) if(paramType.IsValueType) { setIL.Emit(OpCodes.Unbox, paramType); //Unbox it if(mTypeHash[paramType]!=null) //and load { OpCode load = (OpCode)mTypeHash[paramType]; setIL.Emit(load); } else { setIL.Emit(OpCodes.Ldobj,paramType); } } else { setIL.Emit(OpCodes.Castclass, paramType); //Cast class } setIL.EmitCall(OpCodes.Callvirt, targetSetMethod, null); //Set the property value } else { setIL.ThrowException(typeof(MissingMethodException)); } setIL.Emit(OpCodes.Ret); // // Load the type // myType.CreateType(); return newAssembly; } } } --- NEW FILE: PropertyAccessor.cs --- // // Author: James Nies // Date: 3/22/2005 // Description: The PropertyAccessor class provides fast dynamic access // to a property of a specified target class. // // *** This code was written by James Nies and has been provided to you, *** // *** free of charge, for your use. I assume no responsibility for any *** // *** undesired events resulting from the use of this code or the *** // *** information that has been provided with it . *** // using System; using System.Reflection; using System.Reflection.Emit; using System.Threading; using System.Collections; namespace Adapdev.Reflection { /// <summary> /// The PropertyAccessor class provides fast dynamic access /// to a property of a specified target class. /// </summary> public class PropertyAccessor : IValueAccessor { /// <summary> /// Creates a new property accessor. /// </summary> /// <param name="targetType">Target object type.</param> /// <param name="property">Property name.</param> public PropertyAccessor(Type targetType, string property) { this.mTargetType = targetType; this.mProperty = property; PropertyInfo propertyInfo = targetType.GetProperty(property); // // Make sure the property exists // if(propertyInfo == null) { throw new PropertyAccessorException( string.Format("Property \"{0}\" does not exist for type " + "{1}.", property, targetType)); } else { this.mCanRead = propertyInfo.CanRead; this.mCanWrite = propertyInfo.CanWrite; this.mPropertyType = propertyInfo.PropertyType; } } /// <summary> /// Gets the property value from the specified target. /// </summary> /// <param name="target">Target object.</param> /// <returns>Property value.</returns> public object Get(object target) { if(mCanRead) { if(this.mEmittedValueAccessor == null) { this.Init(); } return this.mEmittedValueAccessor.Get(target); } else { throw new PropertyAccessorException( string.Format("Property \"{0}\" does not have a get method.", mProperty)); } } /// <summary> /// Sets the property for the specified target. /// </summary> /// <param name="target">Target object.</param> /// <param name="value">Value to set.</param> public void Set(object target, object value) { if(mCanWrite) { if(this.mEmittedValueAccessor == null) { this.Init(); } // // Set the property value // this.mEmittedValueAccessor.Set(target, value); } else { throw new PropertyAccessorException( string.Format("Property \"{0}\" does not have a set method.", mProperty)); } } /// <summary> /// Whether or not the Property supports read access. /// </summary> public bool CanRead { get { return this.mCanRead; } } /// <summary> /// Whether or not the Property supports write access. /// </summary> public bool CanWrite { get { return this.mCanWrite; } } /// <summary> /// The Type of object this property accessor was /// created for. /// </summary> public Type TargetType { get { return this.mTargetType; } } /// <summary> /// The Type of the Property being accessed. /// </summary> public Type PropertyType { get { return this.mPropertyType; } } private Type mTargetType; private string mProperty; private Type mPropertyType; private IValueAccessor mEmittedValueAccessor; private Hashtable mTypeHash; private bool mCanRead; private bool mCanWrite; /// <summary> /// This method generates creates a new assembly containing /// the Type that will provide dynamic access. /// </summary> private void Init() { this.InitTypes(); // Create the assembly and an instance of the // property accessor class. Assembly assembly = EmitAssembly(); mEmittedValueAccessor = assembly.CreateInstance("Property") as IValueAccessor; if(mEmittedValueAccessor == null) { throw new Exception("Unable to create property accessor."); } } /// <summary> /// Thanks to Ben Ratzlaff for this snippet of code /// http://www.codeproject.com/cs/miscctrl/CustomPropGrid.asp /// /// "Initialize a private hashtable with type-opCode pairs /// so i dont have to write a long if/else statement when outputting msil" /// </summary> private void InitTypes() { mTypeHash=new Hashtable(); mTypeHash[typeof(sbyte)]=OpCodes.Ldind_I1; mTypeHash[typeof(byte)]=OpCodes.Ldind_U1; mTypeHash[typeof(char)]=OpCodes.Ldind_U2; mTypeHash[typeof(short)]=OpCodes.Ldind_I2; mTypeHash[typeof(ushort)]=OpCodes.Ldind_U2; mTypeHash[typeof(int)]=OpCodes.Ldind_I4; mTypeHash[typeof(uint)]=OpCodes.Ldind_U4; mTypeHash[typeof(long)]=OpCodes.Ldind_I8; mTypeHash[typeof(ulong)]=OpCodes.Ldind_I8; mTypeHash[typeof(bool)]=OpCodes.Ldind_I1; mTypeHash[typeof(double)]=OpCodes.Ldind_R8; mTypeHash[typeof(float)]=OpCodes.Ldind_R4; } /// <summary> /// Create an assembly that will provide the get and set methods. /// </summary> private Assembly EmitAssembly() { // // Create an assembly name // AssemblyName assemblyName = new AssemblyName(); assemblyName.Name = "PropertyAccessorAssembly"; // // Create a new assembly with one module // AssemblyBuilder newAssembly = Thread.GetDomain().DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run); ModuleBuilder newModule = newAssembly.DefineDynamicModule("Module"); // // Define a public class named "Property" in the assembly. // TypeBuilder myType = newModule.DefineType("Property", TypeAttributes.Public); // // Mark the class as implementing IPropertyAccessor. // myType.AddInterfaceImplementation(typeof(IValueAccessor)); // Add a constructor ConstructorBuilder constructor = myType.DefineDefaultConstructor(MethodAttributes.Public); // // Define a method for the get operation. // Type[] getParamTypes = new Type[] {typeof(object)}; Type getReturnType = typeof(object); MethodBuilder getMethod = myType.DefineMethod("Get", MethodAttributes.Public | MethodAttributes.Virtual, getReturnType, getParamTypes); // // From the method, get an ILGenerator. This is used to // emit the IL that we want. // ILGenerator getIL = getMethod.GetILGenerator(); // // Emit the IL. // MethodInfo targetGetMethod = this.mTargetType.GetMethod("get_" + this.mProperty); if(targetGetMethod != null) { getIL.DeclareLocal(typeof(object)); getIL.Emit(OpCodes.Ldarg_1); //Load the first argument //(target object) getIL.Emit(OpCodes.Castclass, this.mTargetType); //Cast to the source type getIL.EmitCall(OpCodes.Call, targetGetMethod, null); //Get the property value if(targetGetMethod.ReturnType.IsValueType) { getIL.Emit(OpCodes.Box, targetGetMethod.ReturnType); //Box if necessary } getIL.Emit(OpCodes.Stloc_0); //Store it getIL.Emit(OpCodes.Ldloc_0); } else { getIL.ThrowException(typeof(MissingMethodException)); } getIL.Emit(OpCodes.Ret); // // Define a method for the set operation. // Type[] setParamTypes = new Type[] {typeof(object), typeof(object)}; Type setReturnType = null; MethodBuilder setMethod = myType.DefineMethod("Set", MethodAttributes.Public | MethodAttributes.Virtual, setReturnType, setParamTypes); // // From the method, get an ILGenerator. This is used to // emit the IL that we want. // ILGenerator setIL = setMethod.GetILGenerator(); // // Emit the IL. // MethodInfo targetSetMethod = this.mTargetType.GetMethod("set_" + this.mProperty); if(targetSetMethod != null) { Type paramType = targetSetMethod.GetParameters()[0].ParameterType; setIL.DeclareLocal(paramType); setIL.Emit(OpCodes.Ldarg_1); //Load the first argument //(target object) setIL.Emit(OpCodes.Castclass, this.mTargetType); //Cast to the source type setIL.Emit(OpCodes.Ldarg_2); //Load the second argument //(value object) if(paramType.IsValueType) { setIL.Emit(OpCodes.Unbox, paramType); //Unbox it if(mTypeHash[paramType]!=null) //and load { OpCode load = (OpCode)mTypeHash[paramType]; setIL.Emit(load); } else { setIL.Emit(OpCodes.Ldobj,paramType); } } else { setIL.Emit(OpCodes.Castclass, paramType); //Cast class } setIL.EmitCall(OpCodes.Callvirt, targetSetMethod, null); //Set the property value } else { setIL.ThrowException(typeof(MissingMethodException)); } setIL.Emit(OpCodes.Ret); // // Load the type // myType.CreateType(); return newAssembly; } } } --- NEW FILE: IValueAccessor.cs --- // // Author: James Nies // Date: 3/22/2005 // Description: The PropertyAccessor class uses this interface // for creating a type at runtime for accessing an individual // property on a target object. // // *** This code was written by James Nies and has been provided to you, *** // *** free of charge, for your use. I assume no responsibility for any *** // *** undesired events resulting from the use of this code or the *** // *** information that has been provided with it . *** // using System; namespace Adapdev.Reflection { /// <summary> /// The IPropertyAccessor interface defines a property /// accessor. /// </summary> public interface IValueAccessor { /// <summary> /// Gets the value stored in the property for /// the specified target. /// </summary> /// <param name="target">Object to retrieve /// the property from.</param> /// <returns>Property value.</returns> object Get(object target); /// <summary> /// Sets the value for the property of /// the specified target. /// </summary> /// <param name="target">Object to set the /// property on.</param> /// <param name="value">Property value.</param> void Set(object target, object value); } } --- NEW FILE: PropertyAccessorException.cs --- // // Author: James Nies // Date: 3/22/2005 // Description: Exception that can be thrown from the PropertyAccessor // class. // // *** This code was written by James Nies and has been provided to you, *** // *** free of charge, for your use. I assume no responsibility for any *** // *** undesired events resulting from the use of this code or the *** // *** information that has been provided with it . *** // using System; namespace Adapdev.Reflection { /// <summary> /// PropertyAccessorException class. /// </summary> public class PropertyAccessorException : Exception { public PropertyAccessorException(string message) : base(message) { } } } --- NEW FILE: FieldAccessorException.cs --- using System; namespace Adapdev.Reflection { /// <summary> /// PropertyAccessorException class. /// </summary> public class FieldAccessorException : Exception { public FieldAccessorException(string message) : base(message) { } } } |
From: Sean M. <int...@us...> - 2005-05-25 05:17:58
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Tests Modified Files: Adapdev.Tests.csproj Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation Index: Adapdev.Tests.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/Adapdev.Tests.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Adapdev.Tests.csproj 14 Apr 2005 03:32:05 -0000 1.3 --- Adapdev.Tests.csproj 25 May 2005 05:17:47 -0000 1.4 *************** *** 95,98 **** --- 95,103 ---- HintPath = "..\..\lib\log4net.dll" /> + <Reference + Name = "Adapdev.Mock" + Project = "{7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> </References> </Build> *************** *** 106,109 **** --- 111,129 ---- /> <File + RelPath = "CompositeValidatorTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "IValidatorTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ObjectComparerTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Cryptography\CryptoTest.cs" SubType = "Code" *************** *** 120,123 **** --- 140,173 ---- BuildAction = "Compile" /> + <File + RelPath = "Reflection\ClassAccessorCacheTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\ClassAccessorTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\FieldAccessorTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\FieldAccessorTestObject.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\PropertyAccessorTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\PropertyAccessorTestObject.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> |
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache.Tests/Scavengers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Cache.Tests/Scavengers Added Files: AbsoluteExpirationScavengerTest.cs BaseScavengerTest.cs GreaterThanOrdinalScavengerTest.cs SlidingExpirationScavengerTest.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: SlidingExpirationScavengerTest.cs --- using System; using Adapdev.Cache; using Adapdev.Cache.Scavengers; using Adapdev.Mock; using NUnit.Framework; namespace Adapdev.Cache.Scavengers.Tests { /// <summary> /// Summary description for DateScavenger. /// </summary> /// [TestFixture] public class SlidingExpirationScavengerTest : BaseScavengerTest { public override ICache GetCache() { return new MutableInMemoryCache(); } [Test] public void ScavengeAndRemove() { IScavenger scavenger = new SlidingExpirationScavenger(new TimeSpan(0,0,0,1)); Assert.AreEqual(100, this.cache.Count); System.Threading.Thread.Sleep(2000); this.cache.Scavenge(scavenger); Assert.AreEqual(0, this.cache.Count, "All entries should have been removed"); } [Test] public void ScavengeAndLeave() { IScavenger scavenger = new SlidingExpirationScavenger(new TimeSpan(1,0,0,0)); Assert.AreEqual(100, this.cache.Count); this.cache.Scavenge(scavenger); Assert.AreEqual(100, this.cache.Count, "No entries should have been removed"); } } } --- NEW FILE: GreaterThanOrdinalScavengerTest.cs --- using System; using Adapdev.Cache; using Adapdev.Cache.Scavengers; using Adapdev.Mock; using NUnit.Framework; namespace Adapdev.Cache.Scavengers.Tests { /// <summary> /// Summary description for DateScavenger. /// </summary> /// [TestFixture] public class GreaterThanOrdinalScavengerTest : BaseScavengerTest { public override ICache GetCache() { return new MutableInMemoryCache(); } [Test] public void ScavengeAndRemove() { IScavenger scavenger = new GreaterThanOrdinalScavenger(80); Assert.AreEqual(100, this.cache.Count); this.cache.Scavenge(scavenger); Assert.AreEqual(80, this.cache.Count, "All entries should have been removed"); } [Test] public void ScavengeAndLeave() { IScavenger scavenger = new GreaterThanOrdinalScavenger(100); Assert.AreEqual(100, this.cache.Count); this.cache.Scavenge(scavenger); Assert.AreEqual(100, this.cache.Count, "All entries should have been removed"); } } } --- NEW FILE: AbsoluteExpirationScavengerTest.cs --- using System; using Adapdev.Cache; using Adapdev.Cache.Scavengers; using Adapdev.Mock; using NUnit.Framework; namespace Adapdev.Cache.Scavengers.Tests { /// <summary> /// Summary description for DateScavenger. /// </summary> /// [TestFixture] public class AbsoluteExpirationScavengerTest : BaseScavengerTest { public override ICache GetCache() { return new MutableInMemoryCache(); } [Test] public void ScavengeAndRemove() { IScavenger scavenger = new AbsoluteExpirationScavenger(DateTime.Today.AddDays(1)); Assert.AreEqual(100, this.cache.Count); this.cache.Scavenge(scavenger); Assert.AreEqual(0, this.cache.Count, "All entries should have been removed"); } [Test] public void ScavengeAndLeave() { IScavenger scavenger = new AbsoluteExpirationScavenger(DateTime.Today); Assert.AreEqual(100, this.cache.Count); this.cache.Scavenge(scavenger); Assert.AreEqual(100, this.cache.Count, "All entries should have been removed"); } } } --- NEW FILE: BaseScavengerTest.cs --- using System; using Adapdev.Cache; using Adapdev.Cache.Scavengers; using Adapdev.Mock; using NUnit.Framework; namespace Adapdev.Cache.Scavengers.Tests { /// <summary> /// Summary description for BaseScavengerTest. /// </summary> public abstract class BaseScavengerTest { protected ICache cache = null; public abstract ICache GetCache(); [SetUp] public void SetUp() { this.cache = this.GetCache(); this.PopulateCache(); } [TearDown] public void TearDown() { this.cache.Clear(); } public void PopulateCache() { for(int i = 0; i < 100; i++) { SuppliersEntity e = new SuppliersEntity(); e.SupplierID = i; e.Fax = "12345"; e.CompanyName = "Test"; e.ContactName = "Test"; this.cache.Add(e.SupplierID, e); } } } } |
Update of /cvsroot/adapdev/Adapdev/src/Adapdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev Modified Files: Adapdev.csproj Added Files: CompositeValidator.cs ICompositeValidator.cs IValidationRule.cs IValidator.cs ObjectComparer.cs ValidationResult.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: ICompositeValidator.cs --- using System; namespace Adapdev { /// <summary> /// Summary description for IRuleValidatable. /// </summary> public interface ICompositeValidator : IValidator { void AddRule(IValidationRule rule); } } --- NEW FILE: IValidationRule.cs --- using System; namespace Adapdev { /// <summary> /// Summary description for IRule. /// </summary> public interface IValidationRule { ValidationResult Validate(); } } --- NEW FILE: IValidator.cs --- using System; namespace Adapdev { /// <summary> /// Summary description for IValidator. /// </summary> public interface IValidator { ValidationResult Validate(); } } Index: Adapdev.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev/Adapdev.csproj,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Adapdev.csproj 19 May 2005 03:31:01 -0000 1.6 --- Adapdev.csproj 25 May 2005 05:17:48 -0000 1.7 *************** *** 151,154 **** --- 151,164 ---- /> <File + RelPath = "CompositeValidator.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "ICompositeValidator.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "IProgressCallback.cs" SubType = "Code" *************** *** 156,159 **** --- 166,179 ---- /> <File + RelPath = "IValidationRule.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "IValidator.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "LongLivingMarshalByRefObject.cs" SubType = "Code" *************** *** 161,164 **** --- 181,189 ---- /> <File + RelPath = "ObjectComparer.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "ObjectSorter.cs" SubType = "Code" *************** *** 176,179 **** --- 201,209 ---- /> <File + RelPath = "ValidationResult.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Commands\ICommand.cs" SubType = "Code" *************** *** 266,269 **** --- 296,339 ---- /> <File + RelPath = "Mock\SuppliersEntity.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\ClassAccessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\ClassAccessorCache.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\FieldAccessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\FieldAccessorException.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\IValueAccessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\PropertyAccessor.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File + RelPath = "Reflection\PropertyAccessorException.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Reflection\ReflectionCache.cs" SubType = "Code" --- NEW FILE: ValidationResult.cs --- using System; using System.Text; namespace Adapdev { /// <summary> /// Summary description for ValidationResult. /// </summary> public class ValidationResult { private bool _isValid = true; private StringBuilder _sb = new StringBuilder(); public string Message { get{return this._sb.ToString();} } public bool IsValid { get{return this._isValid;} set{this._isValid = value;} } public void AddMessage(string message) { if(message.Length > 0) { this._sb.Append(message); this._sb.Append(Environment.NewLine); } } } } --- NEW FILE: CompositeValidator.cs --- using System; using System.Collections; namespace Adapdev { /// <summary> /// Summary description for AbstractCompositeValidator. /// </summary> public class CompositeValidator : ICompositeValidator { private ArrayList _rules = new ArrayList(); #region ICompositeValidator Members public void AddRule(IValidationRule rule) { this._rules.Add(rule); } #endregion #region IValidator Members public virtual ValidationResult Validate() { ValidationResult vr = new ValidationResult(); ValidationResult temp = new ValidationResult(); foreach(IValidationRule rule in this._rules) { temp = rule.Validate(); if(!temp.IsValid) { vr.IsValid = false; vr.AddMessage(temp.Message); } } return vr; } #endregion } } --- NEW FILE: ObjectComparer.cs --- using System; using Adapdev.Reflection; namespace Adapdev { /// <summary> /// Summary description for ObjectComparer. /// </summary> public class ObjectComparer { private ObjectComparer() { } public static bool AreEqual(object x, object y) { Type t = x.GetType(); ClassAccessor accessor = ClassAccessorCache.Get(t); try { object p1 = null; object p2 = null; PropertyAccessor property = null; foreach(string key in accessor.GetPropertyAccessors().Keys) { property = accessor.GetPropertyAccessor(key); p1 = accessor.GetPropertyValue(x, key); p2 = accessor.GetPropertyValue(y, key); if(!p1.Equals(Convert.ChangeType(p2, property.PropertyType))) return false; } return true; } catch(ArgumentException) { return false; } } } } |
From: Sean M. <int...@us...> - 2005-05-25 05:17:58
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev/Mock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev/Mock Added Files: SuppliersEntity.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation --- NEW FILE: SuppliersEntity.cs --- /****************************************** * Auto-generated by Codus * 4/20/2005 11:18:21 AM ******************************************/ using System; using Adapdev.Text; namespace Adapdev.Mock { /// <summary> /// An object representation of the Northwind Suppliers table /// </summary> /// [Serializable] public class SuppliersEntity{ private System.String _Address = ""; private System.String _City = ""; private System.String _CompanyName = ""; private System.String _ContactName = ""; private System.String _ContactTitle = ""; private System.String _Country = ""; private System.String _Fax = ""; private System.String _HomePage = ""; private System.String _Phone = ""; private System.String _PostalCode = ""; private System.String _Region = ""; private System.Int32 _SupplierID = 0; private System.DateTime _Created = DateTime.Now; public System.String Address { get { return this._Address; } set { this._Address = value; } } public System.String City { get { return this._City; } set { this._City = value; } } public System.String CompanyName { get { return this._CompanyName; } set { this._CompanyName = value; } } public System.String ContactName { get { return this._ContactName; } set { this._ContactName = value; } } public System.String ContactTitle { get { return this._ContactTitle; } set { this._ContactTitle = value; } } public System.String Country { get { return this._Country; } set { this._Country = value; } } public System.String Fax { get { return this._Fax; } set { this._Fax = value; } } public System.String HomePage { get { return this._HomePage; } set { this._HomePage = value; } } public System.String Phone { get { return this._Phone; } set { this._Phone = value; } } public System.String PostalCode { get { return this._PostalCode; } set { this._PostalCode = value; } } public System.String Region { get { return this._Region; } set { this._Region = value; } } public System.Int32 SupplierID { get { return this._SupplierID; } set { this._SupplierID = value; } } public DateTime Created { get{return this._Created;} set{this._Created = value;} } /// <summary> /// Returns a string representation of the object, displaying all property and field names and values. /// </summary> public override string ToString() { return StringUtil.ToString(this); } } } |
From: Sean M. <int...@us...> - 2005-05-25 05:17:57
|
Update of /cvsroot/adapdev/Adapdev/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src Modified Files: AdapdevAssemblyInfo.cs AdapdevFramework.sln AdapdevFramework.suo Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation Index: AdapdevAssemblyInfo.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevAssemblyInfo.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AdapdevAssemblyInfo.cs 23 Apr 2005 04:54:13 -0000 1.4 --- AdapdevAssemblyInfo.cs 25 May 2005 05:17:48 -0000 1.5 *************** *** 27,31 **** // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.8.1.0")] // --- 27,31 ---- // by using the '*' as shown below: ! [assembly: AssemblyVersion("0.8.1.*")] // Index: AdapdevFramework.suo =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevFramework.suo,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 Binary files /tmp/cvsAkhySW and /tmp/cvsuo7Aez differ Index: AdapdevFramework.sln =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevFramework.sln,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AdapdevFramework.sln 17 Mar 2005 12:50:12 -0000 1.3 --- AdapdevFramework.sln 25 May 2005 05:17:48 -0000 1.4 *************** *** 64,67 **** --- 64,71 ---- EndProjectSection EndProject + Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Adapdev.Mock", "Adapdev.Mock\Adapdev.Mock.csproj", "{7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection + EndProject Global GlobalSection(SolutionConfiguration) = preSolution *************** *** 134,137 **** --- 138,145 ---- {250B6F4B-3256-4DEB-84B6-8C919058FDDC}.Release.ActiveCfg = Release|.NET {250B6F4B-3256-4DEB-84B6-8C919058FDDC}.Release.Build.0 = Release|.NET + {7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}.Debug.ActiveCfg = Debug|.NET + {7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}.Debug.Build.0 = Debug|.NET + {7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}.Release.ActiveCfg = Release|.NET + {7F1E28A3-0AC7-409A-BEC4-A8F39AB23022}.Release.Build.0 = Release|.NET EndGlobalSection GlobalSection(SolutionItems) = postSolution |
From: Sean M. <int...@us...> - 2005-05-25 05:17:57
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Windows.Forms Modified Files: Adapdev.Windows.Forms.csproj Added Files: SmartTreeView.cs SmartTreeView.resx Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation Index: Adapdev.Windows.Forms.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/Adapdev.Windows.Forms.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Adapdev.Windows.Forms.csproj 14 Apr 2005 03:32:07 -0000 1.4 --- Adapdev.Windows.Forms.csproj 25 May 2005 05:17:48 -0000 1.5 *************** *** 186,189 **** --- 186,199 ---- /> <File + RelPath = "SmartTreeView.cs" + SubType = "Component" + BuildAction = "Compile" + /> + <File + RelPath = "SmartTreeView.resx" + DependentUpon = "SmartTreeView.cs" + BuildAction = "EmbeddedResource" + /> + <File RelPath = "SmoothProgressBar.cs" SubType = "UserControl" --- NEW FILE: SmartTreeView.resx --- <?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used forserialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="$this.Name"> <value>SmartTreeView</value> </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> </root> --- NEW FILE: SmartTreeView.cs --- using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace Adapdev.Windows.Forms { public class SmartTreeView : System.Windows.Forms.TreeView { private System.ComponentModel.IContainer components = null; private bool disableAfterSelect = false; private Color checkedFont = Color.Black; private Color uncheckedFont = Color.LightGray; public SmartTreeView() { InitializeComponent(); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { // // SmartTreeView // this.CheckBoxes = true; this.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.SmartTreeView_AfterCheck); } #endregion private void SmartTreeView_AfterCheck(object sender, System.Windows.Forms.TreeViewEventArgs e) { if(!this.disableAfterSelect) { if(e.Node.Checked) CheckParents(e.Node); // Required to avoid a stack overflow this.disableAfterSelect = true; // Check / Uncheck all children CheckChildren(e.Node); this.disableAfterSelect = false; } } private void CheckParents(TreeNode node) { TreeNode treeNode = node; while(treeNode.Parent != null) { // Set the parent to the child's checked state treeNode.Parent.Checked = node.Checked; // Change the state this.ChangeForeColor(treeNode); // Process the parent treeNode = treeNode.Parent; } } private void CheckChildren(TreeNode node) { if(node != null && node.Nodes.Count > 0) { foreach(TreeNode child in node.Nodes) { // Change the checked state to that of the parent child.Checked = node.Checked; // Change the state this.ChangeForeColor(node); // Check all children CheckChildren(child); } } } private void ChangeForeColor(TreeNode node) { if(node.Checked) node.ForeColor = this.CheckedForeColor; else node.ForeColor = this.UncheckedForeColor; } [Category("Appearance"), Description("Sets the font forecolor when the node is checked."), DefaultValue(typeof(Color), "Color.Black"), Browsable(true)] public Color CheckedForeColor { get { return checkedFont; } set { checkedFont = value; } } [Category("Appearance"), Description("Sets the font forecolor when the node is unchecked."), DefaultValue(typeof(Color), "Color.LightGray"), Browsable(true)] public Color UncheckedForeColor { get { return uncheckedFont; } set { uncheckedFont = value; } } } } |
From: Sean M. <int...@us...> - 2005-05-25 05:17:57
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Data/Sql Modified Files: Criteria.cs ICriteria.cs ISelectQuery.cs SelectQuery.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation Index: Criteria.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/Criteria.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Criteria.cs 28 Feb 2005 01:31:48 -0000 1.1.1.1 --- Criteria.cs 25 May 2005 05:17:47 -0000 1.2 *************** *** 34,38 **** { this.AddAnd(); ! sb.Append("(" + c.GetText() + ")"); } --- 34,40 ---- { this.AddAnd(); ! sb.Append("("); ! sb.Append(c.GetText()); ! sb.Append(") "); } *************** *** 45,59 **** public virtual void AddBetween(string columnName, object value1, object value2) { ! sb.Append(" " + columnName + " BETWEEN " + QueryHelper.DressUp(value1,this.type) + " AND " + QueryHelper.DressUp(value2,this.type)); } public virtual void AddEqualTo(string columnName, object columnValue) { ! sb.Append(" " + columnName + " = " + QueryHelper.DressUp(columnValue,this.type)); } public void AddEqualTo(string columnName) { ! sb.Append(" " + columnName + " = " + QueryHelper.GetParameterName(columnName, this.DbProviderType)); } --- 47,96 ---- public virtual void AddBetween(string columnName, object value1, object value2) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" BETWEEN "); ! sb.Append(QueryHelper.DressUp(value1,this.type)); ! sb.Append(" AND "); ! sb.Append(QueryHelper.DressUp(value2,this.type)); ! sb.Append(" "); } public virtual void AddEqualTo(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" = "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); ! } ! ! public virtual void AddEqualTo(string tableName, string columnName, object columnValue) ! { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(tableName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append("."); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" = "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } public void AddEqualTo(string columnName) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" = "); ! sb.Append(QueryHelper.GetParameterName(columnName, this.DbProviderType)); ! sb.Append(" "); } *************** *** 64,78 **** public virtual void AddGreaterThanOrEqualTo(string columnName, object columnValue) { ! sb.Append(" " + columnName + " >= " + QueryHelper.DressUp(columnValue, this.type)); } public virtual void AddGreaterThan(string columnName, object columnValue) { ! sb.Append(" " + columnName + " > " + QueryHelper.DressUp(columnValue, this.type)); } public virtual void AddIn(string columnName, IQuery subQuery) { ! sb.Append(" IN (" + subQuery.GetText() + ") "); } --- 101,129 ---- public virtual void AddGreaterThanOrEqualTo(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" >= "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } public virtual void AddGreaterThan(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" > "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } public virtual void AddIn(string columnName, IQuery subQuery) { ! sb.Append(" IN ("); ! sb.Append(subQuery.GetText()); ! sb.Append(") "); } *************** *** 88,122 **** } sb.Append(StringUtil.RemoveFinalComma(sbo.ToString())); ! sb.Append(")"); } public virtual void AddIsNull(string columnName) { ! sb.Append(" " + columnName + " IS NULL"); } public virtual void AddLessThanOrEqualTo(string columnName, object columnValue) { ! sb.Append(" " + columnName + " <= " + QueryHelper.DressUp(columnValue, this.type)); } public virtual void AddLessThan(string columnName, object columnValue) { ! sb.Append(" " + columnName + " < " + QueryHelper.DressUp(columnValue, this.type)); } public virtual void AddLike(string columnName, object columnValue) { ! sb.Append(" " + columnName + " LIKE " + QueryHelper.DressUp(columnValue, this.type)); } public virtual void AddNotBetween(string columnName, object value1, object value2) { ! sb.Append(" " + columnName + " NOT BETWEEN " + QueryHelper.DressUp(value1, this.type) + " AND " + QueryHelper.DressUp(value2, this.type)); } public virtual void AddNotEqualTo(string columnName, object columnValue) { ! sb.Append(" " + columnName + " <> " + QueryHelper.DressUp(columnValue, this.type)); } --- 139,209 ---- } sb.Append(StringUtil.RemoveFinalComma(sbo.ToString())); ! sb.Append(") "); } public virtual void AddIsNull(string columnName) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" IS NULL "); } public virtual void AddLessThanOrEqualTo(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" <= "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } public virtual void AddLessThan(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" < "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } public virtual void AddLike(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" LIKE "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } public virtual void AddNotBetween(string columnName, object value1, object value2) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" NOT BETWEEN "); ! sb.Append(QueryHelper.DressUp(value1, this.type)); ! sb.Append(" AND "); ! sb.Append(QueryHelper.DressUp(value2, this.type)); ! sb.Append(" "); } public virtual void AddNotEqualTo(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" <> "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } *************** *** 146,155 **** public virtual void AddNotLike(string columnName, object columnValue) { ! sb.Append(" " + columnName + " NOT LIKE " + QueryHelper.DressUp(columnValue, this.type)); } public virtual void AddNotNull(string columnName) { ! sb.Append(" " + columnName + " NOT IS NULL"); } --- 233,252 ---- public virtual void AddNotLike(string columnName, object columnValue) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" NOT LIKE "); ! sb.Append(QueryHelper.DressUp(columnValue,this.type)); ! sb.Append(" "); } public virtual void AddNotNull(string columnName) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" NOT IS NULL "); } Index: SelectQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/SelectQuery.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SelectQuery.cs 28 Feb 2005 01:31:48 -0000 1.1.1.1 --- SelectQuery.cs 25 May 2005 05:17:47 -0000 1.2 *************** *** 37,41 **** public void Add(string columnName) { ! sb.Append(" " + QueryHelper.GetPreDelimeter(this.type) + columnName + QueryHelper.GetPostDelimeter(this.type) + ","); } --- 37,84 ---- public void Add(string columnName) { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(","); ! } ! ! public void Add(string tableName, string columnName) ! { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(tableName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append("."); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(","); ! } ! ! public void AddColumnAlias(string columnName, string alias) ! { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" AS "); ! sb.Append(alias); ! sb.Append(","); ! } ! ! public void AddColumnAlias(string tableName, string columnName, string alias) ! { ! sb.Append(" "); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(tableName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append("."); ! sb.Append(QueryHelper.GetPreDelimeter(this.type)); ! sb.Append(columnName); ! sb.Append(QueryHelper.GetPostDelimeter(this.type)); ! sb.Append(" AS "); ! sb.Append(alias); ! sb.Append(","); } *************** *** 83,87 **** public virtual void AddJoin(string secondTable, string firstTableColumn, string secondTableColumn, JoinType type) { ! this._join = String.Format(" {0} {1} ON {2} = {3} ", this.GetJoinType(type), secondTable, firstTableColumn, secondTableColumn); } --- 126,135 ---- public virtual void AddJoin(string secondTable, string firstTableColumn, string secondTableColumn, JoinType type) { ! this._join = String.Format(" {0} {1} ON {2}.{3} = {4}.{5} ", this.GetJoinType(type), ! QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), ! this._table, ! QueryHelper.GetPreDelimeter(this.type) + firstTableColumn + QueryHelper.GetPostDelimeter(this.type), ! QueryHelper.GetPreDelimeter(this.type) + secondTable + QueryHelper.GetPostDelimeter(this.type), ! QueryHelper.GetPreDelimeter(this.type) + secondTableColumn + QueryHelper.GetPostDelimeter(this.type)); } *************** *** 93,97 **** public virtual string GetText() { ! return "SELECT " + this.GetLimit() + this.GetColumns() + " FROM " + this._table + this.GetCriteria() + this.GetOrderBy() + this.GetGroupBy(); } --- 141,145 ---- public virtual string GetText() { ! return "SELECT " + this.GetLimit() + this.GetColumns() + " FROM " + this._table + this._join + this.GetCriteria() + this.GetOrderBy() + this.GetGroupBy(); } *************** *** 183,189 **** return "INNER JOIN"; case JoinType.LEFT: ! return "LEFT JOIN"; case JoinType.RIGHT: ! return "RIGHT JOIN"; default: throw new Exception("JoinType " + type + " not supported."); --- 231,237 ---- return "INNER JOIN"; case JoinType.LEFT: ! return "LEFT OUTER JOIN"; case JoinType.RIGHT: ! return "RIGHT OUTER JOIN"; default: throw new Exception("JoinType " + type + " not supported."); Index: ICriteria.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/ICriteria.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ICriteria.cs 28 Feb 2005 01:31:48 -0000 1.1.1.1 --- ICriteria.cs 25 May 2005 05:17:47 -0000 1.2 *************** *** 13,16 **** --- 13,17 ---- void AddBetween(string columnName, object value1, object value2); void AddEqualTo(string columnName, object columnValue); + void AddEqualTo(string tableName, string columnName, object columnValue); void AddEqualTo(string columnName); void AddExists(IQuery subQuery); Index: ISelectQuery.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/ISelectQuery.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** ISelectQuery.cs 28 Feb 2005 01:31:48 -0000 1.1.1.1 --- ISelectQuery.cs 25 May 2005 05:17:47 -0000 1.2 *************** *** 12,15 **** --- 12,34 ---- void Add(string columnName); /// <summary> + /// Adds the specified table.column + /// </summary> + /// <param name="tableName">Name of the table.</param> + /// <param name="columnName">Name of the column.</param> + void Add(string tableName, string columnName); + /// <summary> + /// Adds the column alias. + /// </summary> + /// <param name="tableName">Name of the table.</param> + /// <param name="columnName">Name of the column.</param> + /// <param name="alias">Alias.</param> + void AddColumnAlias(string tableName, string columnName, string alias); + /// <summary> + /// Adds the column alias. + /// </summary> + /// <param name="columnName">Name of the column.</param> + /// <param name="alias">Alias.</param> + void AddColumnAlias(string columnName, string alias); + /// <summary> /// Creates a SELECT * FROM statement, so that individual column names /// don't have to be added |
From: Sean M. <int...@us...> - 2005-05-25 05:17:57
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10621/src/Adapdev.Windows.Forms.Tests Modified Files: Adapdev.Windows.Forms.Tests.csproj Added Files: SmartTreeViewTest.cs Log Message: MIgrated reusable Perseus components Added SmartTreeView Added new caching framework Several Sql fixes Added business rule validation classes Added FieldAccessor for IL generation Index: Adapdev.Windows.Forms.Tests.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms.Tests/Adapdev.Windows.Forms.Tests.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Adapdev.Windows.Forms.Tests.csproj 14 Apr 2005 03:32:06 -0000 1.3 --- Adapdev.Windows.Forms.Tests.csproj 25 May 2005 05:17:48 -0000 1.4 *************** *** 85,88 **** --- 85,108 ---- HintPath = "..\..\lib\log4net.dll" /> + <Reference + Name = "nunit.framework" + AssemblyName = "nunit.framework" + HintPath = "..\..\lib\nunit.framework.dll" + /> + <Reference + Name = "Adapdev.Windows.Forms" + Project = "{0BE602B6-D67E-414E-B852-A2AC61305E8E}" + Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" + /> + <Reference + Name = "System.Windows.Forms" + AssemblyName = "System.Windows.Forms" + HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll" + /> + <Reference + Name = "System.Drawing" + AssemblyName = "System.Drawing" + HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll" + /> </References> </Build> *************** *** 95,98 **** --- 115,123 ---- BuildAction = "Compile" /> + <File + RelPath = "SmartTreeViewTest.cs" + SubType = "Code" + BuildAction = "Compile" + /> </Include> </Files> --- NEW FILE: SmartTreeViewTest.cs --- using System; using System.Windows.Forms; using NUnit.Framework; using Adapdev.Windows.Forms; namespace Adapdev.Windows.Forms.Tests { using System.Drawing; /// <summary> /// Summary description for SmartTreeViewTest. /// </summary> /// [TestFixture] public class SmartTreeViewTest { SmartTreeView tree = null; [SetUp] public void BuildTree() { tree = new SmartTreeView(); TreeNode root = new TreeNode("Root"); tree.Nodes.Add(root); TreeNode node1 = new TreeNode("Node1"); TreeNode child1 = new TreeNode("Child1"); TreeNode child2 = new TreeNode("Child2"); node1.Nodes.Add(child1); node1.Nodes.Add(child2); TreeNode node2 = new TreeNode("Node2"); TreeNode child3 = new TreeNode("Child3"); TreeNode child4 = new TreeNode("Child4"); node2.Nodes.Add(child3); node2.Nodes.Add(child4); root.Nodes.Add(node1); root.Nodes.Add(node2); /* * Structure: * Root * Node1 * Child1 * Child2 * Node2 * Child3 * Child4 **/ } [Test] public void CheckParents() { // Make sure all nodes are at the proper state Assert.IsTrue(this.GetChild1().Checked == false, "Child1 should not be checked."); Assert.IsTrue(this.GetNode1().Checked == false, "Node1 should not be checked."); Assert.IsTrue(this.GetRoot().Checked == false, "Root should not be checked."); // Check the child, which should check all parents this.GetChild1().Checked = true; Assert.IsTrue(this.GetNode1().Checked, "Node1 should be checked."); Assert.IsTrue(this.GetRoot().Checked, "Root should be checked."); // Uncheck the child...parents should remain checked this.GetChild1().Checked = false; Assert.IsTrue(this.GetNode1().Checked, "Node1 should be checked."); Assert.IsTrue(this.GetRoot().Checked, "Root should be checked."); } [Test] public void CheckChildren() { // Make sure all nodes are at the proper state Assert.IsTrue(this.GetChild1().Checked == false, "Child1 should not be checked."); Assert.IsTrue(this.GetNode1().Checked == false, "Node1 should not be checked."); Assert.IsTrue(this.GetRoot().Checked == false, "Root should not be checked."); // Check the root node this.GetRoot().Checked = true; // All child nodes should be checked Assert.IsTrue(this.GetRoot().Checked, "Root should be checked."); Assert.IsTrue(this.GetNode1().Checked, "Node1 should be checked."); Assert.IsTrue(this.GetNode2().Checked, "Node2 should be checked."); Assert.IsTrue(this.GetChild1().Checked, "Child1 should be checked."); Assert.IsTrue(this.GetChild2().Checked, "Child2 should be checked."); Assert.IsTrue(this.GetChild3().Checked, "Child3 should be checked."); Assert.IsTrue(this.GetChild4().Checked, "Child4 should be checked."); // Uncheck the root node this.GetRoot().Checked = false; // All child nodes should be unchecked Assert.IsFalse(this.GetRoot().Checked, "Root should not be checked."); Assert.IsFalse(this.GetNode1().Checked, "Node1 should not be checked."); Assert.IsFalse(this.GetNode2().Checked, "Node2 should not be checked."); Assert.IsFalse(this.GetChild1().Checked, "Child1 should not be checked."); Assert.IsFalse(this.GetChild2().Checked, "Child2 should not be checked."); Assert.IsFalse(this.GetChild3().Checked, "Child3 should not be checked."); Assert.IsFalse(this.GetChild4().Checked, "Child4 should not be checked."); } [Test] public void CheckColor() { // IMPORTANT - need to set the root node checked value // Test fails otherwise, since the Color comes up // as Color.Empty this.GetRoot().Checked = false; // Node1 should be unchecked and light gray Assert.AreEqual(Color.LightGray, this.GetNode1().ForeColor, "Node1 unchecked color is incorrect."); // Root should be unchecked and light gray Assert.AreEqual(Color.LightGray, this.GetRoot().ForeColor, "Root unchecked color is incorrect."); this.GetNode1().Checked = true; // Node1 should be checked and black Assert.AreEqual(Color.Black, this.GetNode1().ForeColor); // Root should be checked and black Assert.AreEqual(Color.Black, this.GetRoot().ForeColor); } [Test] public void ValidateStructure() { Assert.AreEqual("Root", this.GetRoot().Text); Assert.AreEqual("Node1", this.GetNode1().Text); Assert.AreEqual("Node2", this.GetNode2().Text); Assert.AreEqual("Child1", this.GetChild1().Text); Assert.AreEqual("Child2", this.GetChild2().Text); Assert.AreEqual("Child3", this.GetChild3().Text); Assert.AreEqual("Child4", this.GetChild4().Text); } #region Utility Methods private TreeNode GetRoot() { return tree.Nodes[0]; } private TreeNode GetNode1() { return this.GetRoot().Nodes[0]; } private TreeNode GetNode2() { return this.GetRoot().Nodes[1]; } private TreeNode GetChild1() { return this.GetNode1().Nodes[0]; } private TreeNode GetChild2() { return this.GetNode1().Nodes[1]; } private TreeNode GetChild3() { return this.GetNode2().Nodes[0]; } private TreeNode GetChild4() { return this.GetNode2().Nodes[1]; } #endregion } } |
From: Sean M. <int...@us...> - 2005-05-25 05:14:32
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Cache.Tests/Scavengers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10128/Scavengers Log Message: Directory /cvsroot/adapdev/Adapdev/src/Adapdev.Cache.Tests/Scavengers added to the repository |
From: Sean M. <int...@us...> - 2005-05-25 05:12:24
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev/Mock In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9948/Mock Log Message: Directory /cvsroot/adapdev/Adapdev/src/Adapdev/Mock added to the repository |
From: Trevor L. <tre...@us...> - 2005-05-20 02:11:02
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14354/src/Adapdev.Data/Sql Modified Files: QueryConstants.cs QueryHelper.cs Log Message: Fixed Oracle issue with Parameters. Added ':' to the front of paramter placeholders. Index: QueryConstants.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/QueryConstants.cs,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** QueryConstants.cs 28 Feb 2005 01:31:48 -0000 1.1.1.1 --- QueryConstants.cs 20 May 2005 02:10:53 -0000 1.2 *************** *** 16,19 **** --- 16,22 ---- public const char ACCESS_DATE = '#'; + public const char ORACLE_STRING = '\''; + public const char ORACLE_DATE = '\''; + } } \ No newline at end of file Index: QueryHelper.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Sql/QueryHelper.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QueryHelper.cs 14 Apr 2005 03:43:41 -0000 1.3 --- QueryHelper.cs 20 May 2005 02:10:53 -0000 1.4 *************** *** 137,141 **** case DbProviderType.ORACLE: columnName = StringUtil.RemoveSpaces(columnName); ! return columnName; case DbProviderType.OLEDB: return "?"; --- 137,141 ---- case DbProviderType.ORACLE: columnName = StringUtil.RemoveSpaces(columnName); ! return ":" + columnName; case DbProviderType.OLEDB: return "?"; *************** *** 158,162 **** public static string GetOracleLastInsertedCommand(string table, string column) { ! string s = "SELECT MAX([" + column + "]) FROM " + table + ";"; Console.WriteLine(s); return s; --- 158,162 ---- public static string GetOracleLastInsertedCommand(string table, string column) { ! string s = "SELECT MAX(" + column + ") FROM " + table + ";"; Console.WriteLine(s); return s; |
From: Sean M. <int...@us...> - 2005-05-19 03:31:38
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10678/src/Adapdev.Data/Schema Modified Files: SchemaBuilder.cs Log Message: Index: SchemaBuilder.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Data/Schema/SchemaBuilder.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SchemaBuilder.cs 13 May 2005 03:51:26 -0000 1.7 --- SchemaBuilder.cs 19 May 2005 03:30:58 -0000 1.8 *************** *** 30,33 **** --- 30,43 ---- /// </summary> /// <param name="oledbConnectionString">The OleDb connection to use</param> + /// <returns></returns> + public static DatabaseSchema CreateDatabaseSchema(string oledbConnectionString, Adapdev.Data.DbType databaseType, DbProviderType providerType) + { + return SchemaBuilder.CreateDatabaseSchema(oledbConnectionString, databaseType, providerType, "", null); + } + + /// <summary> + /// Builds the DatabaseSchema for a specified database + /// </summary> + /// <param name="oledbConnectionString">The OleDb connection to use</param> /// <param name="providerType">The DbProviderType to set the DatabaseSchema to</param> /// <returns></returns> *************** *** 51,55 **** if (_callback != null) { _callback.SetText("Obtaining Schema Details",""); ! _callback.SetAutoClose(ProgressAutoCloseTypes.WaitOnEnd); } --- 61,65 ---- if (_callback != null) { _callback.SetText("Obtaining Schema Details",""); ! _callback.SetAutoClose(ProgressAutoCloseTypes.WaitOnError); } *************** *** 71,75 **** TableSchema ti = CreateTableSchema(dr); CreateColumnSchemas(ti, oledbConnectionString, databaseType); ! di.AddTable(ti); } } --- 81,86 ---- TableSchema ti = CreateTableSchema(dr); CreateColumnSchemas(ti, oledbConnectionString, databaseType); ! ! if(ti.Columns.Count > 0) di.AddTable(ti); } } |
From: Sean M. <int...@us...> - 2005-05-19 03:31:15
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Data.Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10678/src/Adapdev.Data.Tests Added Files: ProviderInfoManagerTest.cs Log Message: --- NEW FILE: ProviderInfoManagerTest.cs --- using System; using Adapdev.Data; using NUnit.Framework; namespace Adapdev.Data.Tests { /// <summary> /// Summary description for ProviderInfoManagerTest. /// </summary> /// [TestFixture] public class ProviderInfoManagerTest { [Test] public void GetDefaultValue() { int oracleId = ProviderInfoManager.GetInstance().GetIdByName(DbProviderType.ORACLE,"CHAR"); Assert.AreEqual(129, oracleId, "Oracle types don't match."); int sqlId = ProviderInfoManager.GetInstance().GetIdByName(DbProviderType.SQLSERVER, "CHAR"); Assert.AreEqual(129, sqlId, "Sql Server types don't match."); } } } |
From: Sean M. <int...@us...> - 2005-05-19 03:31:11
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10678/src/Adapdev Modified Files: Adapdev.csproj Log Message: Index: Adapdev.csproj =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev/Adapdev.csproj,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Adapdev.csproj 13 May 2005 03:51:27 -0000 1.5 --- Adapdev.csproj 19 May 2005 03:31:01 -0000 1.6 *************** *** 161,165 **** /> <File ! RelPath = "ObjectComparer.cs" SubType = "Code" BuildAction = "Compile" --- 161,165 ---- /> <File ! RelPath = "ObjectSorter.cs" SubType = "Code" BuildAction = "Compile" |
From: Sean M. <int...@us...> - 2005-05-19 03:31:09
|
Update of /cvsroot/adapdev/Adapdev/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10678/src Modified Files: AdapdevFramework.suo Log Message: Index: AdapdevFramework.suo =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/AdapdevFramework.suo,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 Binary files /tmp/cvswIbPUw and /tmp/cvsoUmRKC differ |
From: Sean M. <int...@us...> - 2005-05-19 03:31:09
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10678/src/Adapdev.Windows.Forms Modified Files: DatabaseWizard.cs DatabaseWizard.resx Log Message: Index: DatabaseWizard.resx =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/DatabaseWizard.resx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DatabaseWizard.resx 14 Apr 2005 03:43:43 -0000 1.4 --- DatabaseWizard.resx 19 May 2005 03:30:59 -0000 1.5 *************** *** 242,248 **** <value>Private</value> </data> - <data name="tbFilter.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>Private</value> - </data> <data name="tbFilter.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> --- 242,245 ---- *************** *** 251,254 **** --- 248,254 ---- <value>False</value> </data> + <data name="tbFilter.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Private</value> + </data> <data name="lblFilter.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> *************** *** 260,266 **** <value>Private</value> </data> - <data name="tbLocation.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>Private</value> - </data> <data name="tbLocation.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> --- 260,263 ---- *************** *** 269,272 **** --- 266,272 ---- <value>False</value> </data> + <data name="tbLocation.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>Private</value> + </data> <data name="btnOpenFile.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> *************** *** 413,428 **** <value>True</value> </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> - <data name="$this.Name"> - <value>DatabaseWizard</value> - </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> - <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>(Default)</value> - </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> --- 413,425 ---- <value>True</value> </data> + <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>(Default)</value> + </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> *************** *** 431,434 **** --- 428,434 ---- <value>Private</value> </data> + <data name="$this.Name"> + <value>DatabaseWizard</value> + </data> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>8, 8</value> Index: DatabaseWizard.cs =================================================================== RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Windows.Forms/DatabaseWizard.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DatabaseWizard.cs 14 Apr 2005 03:43:43 -0000 1.4 --- DatabaseWizard.cs 19 May 2005 03:30:58 -0000 1.5 *************** *** 44,54 **** private System.Windows.Forms.Label lblFilter; private System.Windows.Forms.TextBox tbFilter; ! private ProviderConfig _providersConfig = new ProviderConfig(); ! public DatabaseWizard() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); ! this.BuildConnectionsTree(this.tvConnectionTypes); ! this.SetGUIProperties(null); // TODO: Add any initialization after the InitializeComponent call --- 44,63 ---- private System.Windows.Forms.Label lblFilter; private System.Windows.Forms.TextBox tbFilter; ! private ProviderConfig _providersConfig = null; ! public DatabaseWizard() ! { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); ! ! // Hack, since VS.NET IDE bombs out when loading ! // this control since it can't find the ! // ProviderConfig.xml file ! try{ ! this._providersConfig = new ProviderConfig(); ! this.BuildConnectionsTree(this.tvConnectionTypes); ! this.SetGUIProperties(null); ! } ! catch(Exception){} // TODO: Add any initialization after the InitializeComponent call *************** *** 115,119 **** this.tbConnectionString.ReadOnly = true; this.tbConnectionString.Size = new System.Drawing.Size(424, 20); ! this.tbConnectionString.TabIndex = 5; this.tbConnectionString.Text = ""; // --- 124,128 ---- this.tbConnectionString.ReadOnly = true; this.tbConnectionString.Size = new System.Drawing.Size(424, 20); ! this.tbConnectionString.TabIndex = 9; this.tbConnectionString.Text = ""; // *************** *** 124,128 **** this.lblConnection.Name = "lblConnection"; this.lblConnection.Size = new System.Drawing.Size(104, 23); ! this.lblConnection.TabIndex = 4; this.lblConnection.Text = "Connection String:"; this.lblConnection.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; --- 133,137 ---- this.lblConnection.Name = "lblConnection"; this.lblConnection.Size = new System.Drawing.Size(104, 23); ! this.lblConnection.TabIndex = 40; this.lblConnection.Text = "Connection String:"; this.lblConnection.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; *************** *** 134,138 **** this.btnNewDatabase.Name = "btnNewDatabase"; this.btnNewDatabase.Size = new System.Drawing.Size(56, 23); ! this.btnNewDatabase.TabIndex = 1; this.btnNewDatabase.Text = "New"; this.btnNewDatabase.Click += new System.EventHandler(this.btnNewDatabase_Click); --- 143,147 ---- this.btnNewDatabase.Name = "btnNewDatabase"; this.btnNewDatabase.Size = new System.Drawing.Size(56, 23); ! this.btnNewDatabase.TabIndex = 10; this.btnNewDatabase.Text = "New"; this.btnNewDatabase.Click += new System.EventHandler(this.btnNewDatabase_Click); *************** *** 144,148 **** this.btnTestConnection.Name = "btnTestConnection"; this.btnTestConnection.Size = new System.Drawing.Size(96, 23); ! this.btnTestConnection.TabIndex = 2; this.btnTestConnection.Text = "Test Connection"; this.btnTestConnection.Click += new System.EventHandler(this.btnTestConnection_Click); --- 153,157 ---- this.btnTestConnection.Name = "btnTestConnection"; this.btnTestConnection.Size = new System.Drawing.Size(96, 23); ! this.btnTestConnection.TabIndex = 11; this.btnTestConnection.Text = "Test Connection"; this.btnTestConnection.Click += new System.EventHandler(this.btnTestConnection_Click); *************** *** 185,189 **** this.tbFilter.Name = "tbFilter"; this.tbFilter.Size = new System.Drawing.Size(136, 20); ! this.tbFilter.TabIndex = 12; this.tbFilter.Text = ""; this.tbFilter.TextChanged += new System.EventHandler(this.tbFilter_TextChanged); --- 194,198 ---- this.tbFilter.Name = "tbFilter"; this.tbFilter.Size = new System.Drawing.Size(136, 20); ! this.tbFilter.TabIndex = 7; this.tbFilter.Text = ""; this.tbFilter.TextChanged += new System.EventHandler(this.tbFilter_TextChanged); *************** *** 193,197 **** this.lblFilter.Location = new System.Drawing.Point(8, 152); this.lblFilter.Name = "lblFilter"; ! this.lblFilter.TabIndex = 11; this.lblFilter.Text = "Schema Filter:"; this.lblFilter.TextAlign = System.Drawing.ContentAlignment.MiddleRight; --- 202,206 ---- this.lblFilter.Location = new System.Drawing.Point(8, 152); this.lblFilter.Name = "lblFilter"; ! this.lblFilter.TabIndex = 0; this.lblFilter.Text = "Schema Filter:"; this.lblFilter.TextAlign = System.Drawing.ContentAlignment.MiddleRight; *************** *** 221,225 **** this.lblName.Location = new System.Drawing.Point(8, 56); this.lblName.Name = "lblName"; ! this.lblName.TabIndex = 5; this.lblName.Text = "Name: "; this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; --- 230,234 ---- this.lblName.Location = new System.Drawing.Point(8, 56); this.lblName.Name = "lblName"; ! this.lblName.TabIndex = 0; this.lblName.Text = "Name: "; this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleRight; *************** *** 232,236 **** this.tbName.Name = "tbName"; this.tbName.Size = new System.Drawing.Size(136, 20); ! this.tbName.TabIndex = 6; this.tbName.Text = ""; this.tbName.TextChanged += new System.EventHandler(this.tbName_TextChanged); --- 241,245 ---- this.tbName.Name = "tbName"; this.tbName.Size = new System.Drawing.Size(136, 20); ! this.tbName.TabIndex = 4; this.tbName.Text = ""; this.tbName.TextChanged += new System.EventHandler(this.tbName_TextChanged); *************** *** 240,244 **** this.lblPassword.Location = new System.Drawing.Point(8, 120); this.lblPassword.Name = "lblPassword"; ! this.lblPassword.TabIndex = 9; this.lblPassword.Text = "Password: "; this.lblPassword.TextAlign = System.Drawing.ContentAlignment.MiddleRight; --- 249,253 ---- this.lblPassword.Location = new System.Drawing.Point(8, 120); this.lblPassword.Name = "lblPassword"; ! this.lblPassword.TabIndex = 0; this.lblPassword.Text = "Password: "; this.lblPassword.TextAlign = System.Drawing.ContentAlignment.MiddleRight; *************** *** 248,252 **** this.lblUsername.Location = new System.Drawing.Point(8, 88); this.lblUsername.Name = "lblUsername"; ! this.lblUsername.TabIndex = 7; this.lblUsername.Text = "Username: "; this.lblUsername.TextAlign = System.Drawing.ContentAlignment.MiddleRight; --- 257,261 ---- this.lblUsername.Location = new System.Drawing.Point(8, 88); this.lblUsername.Name = "lblUsername"; ! this.lblUsername.TabIndex = 0; this.lblUsername.Text = "Username: "; this.lblUsername.TextAlign = System.Drawing.ContentAlignment.MiddleRight; *************** *** 256,260 **** this.lblLocation.Location = new System.Drawing.Point(8, 24); this.lblLocation.Name = "lblLocation"; ! this.lblLocation.TabIndex = 2; this.lblLocation.Text = "Server / Location: "; this.lblLocation.TextAlign = System.Drawing.ContentAlignment.MiddleRight; --- 265,269 ---- this.lblLocation.Location = new System.Drawing.Point(8, 24); this.lblLocation.Name = "lblLocation"; ! this.lblLocation.TabIndex = 0; this.lblLocation.Text = "Server / Location: "; this.lblLocation.TextAlign = System.Drawing.ContentAlignment.MiddleRight; *************** *** 267,271 **** this.tbPassword.Name = "tbPassword"; this.tbPassword.Size = new System.Drawing.Size(136, 20); ! this.tbPassword.TabIndex = 10; this.tbPassword.Text = ""; this.tbPassword.TextChanged += new System.EventHandler(this.tbPassword_TextChanged); --- 276,280 ---- this.tbPassword.Name = "tbPassword"; this.tbPassword.Size = new System.Drawing.Size(136, 20); ! this.tbPassword.TabIndex = 6; this.tbPassword.Text = ""; this.tbPassword.TextChanged += new System.EventHandler(this.tbPassword_TextChanged); *************** *** 278,282 **** this.tbUsername.Name = "tbUsername"; this.tbUsername.Size = new System.Drawing.Size(136, 20); ! this.tbUsername.TabIndex = 8; this.tbUsername.Text = ""; this.tbUsername.TextChanged += new System.EventHandler(this.tbUsername_TextChanged); --- 287,291 ---- this.tbUsername.Name = "tbUsername"; this.tbUsername.Size = new System.Drawing.Size(136, 20); ! this.tbUsername.TabIndex = 5; this.tbUsername.Text = ""; this.tbUsername.TextChanged += new System.EventHandler(this.tbUsername_TextChanged); *************** *** 291,295 **** this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(288, 48); ! this.groupBox2.TabIndex = 44; this.groupBox2.TabStop = false; this.groupBox2.Text = "Connection Settings"; --- 300,304 ---- this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(288, 48); ! this.groupBox2.TabIndex = 1; this.groupBox2.TabStop = false; this.groupBox2.Text = "Connection Settings"; *************** *** 302,306 **** this.tbConnectionName.Name = "tbConnectionName"; this.tbConnectionName.Size = new System.Drawing.Size(168, 20); ! this.tbConnectionName.TabIndex = 1; this.tbConnectionName.Text = ""; // --- 311,315 ---- this.tbConnectionName.Name = "tbConnectionName"; this.tbConnectionName.Size = new System.Drawing.Size(168, 20); ! this.tbConnectionName.TabIndex = 2; this.tbConnectionName.Text = ""; // *************** *** 323,327 **** this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(240, 240); ! this.groupBox3.TabIndex = 45; this.groupBox3.TabStop = false; this.groupBox3.Text = "Select the connection type:"; --- 332,336 ---- this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(240, 240); ! this.groupBox3.TabIndex = 1; this.groupBox3.TabStop = false; this.groupBox3.Text = "Select the connection type:"; |
From: Sean M. <int...@us...> - 2005-05-13 03:53:47
|
Update of /cvsroot/adapdev/Adapdev/src/Adapdev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10694/src/Adapdev Removed Files: ObjectComparer.cs Log Message: --- ObjectComparer.cs DELETED --- |