|
|
|
//Fields attribute base class |
|
[AttributeUsage(AttributeTargets.Field , Inherited = true, AllowMultiple = false)] |
|
public class MemberAttributeBase : System.Attribute |
|
{ |
|
public Type Class; |
|
public Type Collection; |
|
public string Member; |
|
public string Filter; |
|
public string Order; |
|
public string Key; |
|
public
int Max; |
|
public Type Element |
|
|
public string ClassName |
|
|
public virtual bool IsRelation |
|
|
public virtual bool IsScalar |
|
|
public virtual bool IsIdentity |
|
|
public virtual bool IsTransient |
|
|
public MemberAttributeBase(Type Class) |
|
|
} |
|
|
|
//Fields relation attibute class |
|
[AttributeUsage(AttributeTargets.Field , Inherited = true, AllowMultiple = false)] |
|
public class Relation : MemberAttributeBase |
|
{ |
|
public override bool IsRelation |
|
|
} |
|
|
|
//Fields indentity class |
|
[AttributeUsage(AttributeTargets.Field , Inherited = true, AllowMultiple = false)] |
|
public class Identity : MemberAttributeBase |
|
{ |
|
public static bool ValueIsEmpty(object value) |
|
|
public static bool IsPrimitive(object value) |
|
|
public static bool IsEmpty(object obj) |
|
|
public static FieldInfo Get(Type type) |
|
|
public static FieldInfo Get(object obj) |
|
|
public static void Set(object obj,object value) |
|
|
public static void Search(ISyntax syntax,object obj) |
|
|
public override bool IsIdentity |
|
|
} |
|
|
|
//Fields scalar attibute class |
|
[AttributeUsage(AttributeTargets.Field , Inherited = true, AllowMultiple = false)] |
|
public class Scalar : MemberAttributeBase |
|
{ |
|
public override bool IsScalar |
|
|
} |
|
|
|
//Fields transient attibute class |
|
[AttributeUsage(AttributeTargets.Field , Inherited = true, AllowMultiple = false)] |
|
public class Transient : MemberAttributeBase |
|
{ |
|
public override bool IsTransient |
|
|
} |
|
|
|
//Persistent objects base interface |
|
public interface IObject |
|
{ |
|
bool OnCreate(); |
|
void OnCreateComplete(); |
|
bool OnUpdate(); |
|
bool OnRemove(); |
|
void OnValidate(IErrorWriter Error); |
|
} |
|
|
|
//Persistent objects base interface |
|
public class ObjectBase : IObject |
|
{ |
|
protected object this[string Name] |
|
|
public ObjectBase() |
|
|
public virtual bool OnCreate() |
|
|
public virtual void OnCreateComplete() |
|
|
public virtual bool OnUpdate() |
|
|
public virtual bool OnRemove() |
|
|
public virtual void OnValidate(IErrorWriter Error) |
|
|
public static object Copy(object Instance) |
|
|
} |
|
|
|
//Collection of persistent object class |
|
public
class Collection : System.Collections.ArrayList |
|
{ |
|
public Collection(Type Class) |
|
|
public static implicit operator object[](Collection List) |
|
|
} |
|
|
|
//Error writer interface |
|
public interface IErrorWriter |
|
{ |
|
void Write(string Message); |
|
void Write(object value,string Message); |
|
void Write(int value,int Min,int Max,string Message); |
|
void Write(double value,double Min,double Max,string Message); |
|
void Write(string value,string Message); |
|
void Write(DateTime value,DateTime Min,DateTime Max,string Message); |
|
void WriteUri(string value,string Message); |
|
void WriteMail(string value,string Message); |
|
bool Empty |
|
|
} |
|
|
|
//Package interface |
|
public interface IPackage |
|
{ |
|
void Pack (object value); |
|
object UnPack (Type Class); |
|
} |
|
|
|
//Binary package class |
|
public class BinaryPackage : IPackage |
|
{ |
|
public string ToBase64 |
|
|
public byte[] ToBytes |
|
|
void IPackage.Pack (object value) |
|
|
object IPackage.UnPack (Type Class) |
|
|
} |
|
|
|
//IFilter interface |
|
public interface IFilter |
|
{ |
|
void And(); |
|
void Or(); |
|
void Not(); |
|
void Xor(); |
|
void Search(string Name,string Operator,object value); |
|
void Search(string Name,object value); |
|
void Search(object Instance); |
|
void Like(string Name,string value); |
|
void Between(string Name,object Start,object End); |
|
void In(string Name,params object[] Params); |
|
void Filter(string Filter,params object[] Params); |
|
void Exists(Type Class,string Filter,params object[] Params); |
|
void Exists(object Syntax); |
|
void IN(string Name,Type Class,string Member,string Filter,params object[] Params); |
|
void IN(string Name,object Syntax); |
|
void Order(string Name,bool Asc); |
|
void Order(string Name); |
|
} |
|
|
|
//Syntax interface |
|
public interface ISyntax : IFilter |
|
{ |
|
int Max |
|
|
Type Class |
|
|
void Select(Type Class,params string[] Members); |
|
void Update(object Instance,params string[] Members); |
|
void Insert(object Instance,bool All); |
|
void Delete(Type Class); |
|
void Call(Type Class,object Method,params object[] Params); |
|
void Inner(string Entity,string Filter); |
|
void Left(string Entity,string Filter); |
|
void Right(string Entity,string Filter); |
|
void Group(string Name); |
|
void Filter(IFilter Filter); |
|
} |
|
|
|
//Syntax base class |
|
public class Syntax : ISyntax |
|
{ |
|
protected virtual void Clear() |
|
|
protected virtual void WriteElement(Element Element) |
|
|
protected virtual void WriteMax(int Max) |
|
|
protected virtual void WriteMember(string Member) |
|
|
protected virtual void WriteClass(Type Class,string Alias,Element Lock) |
|
|
protected virtual void WriteEntity(string Entity,string Alias,Element Lock) |
|
|
protected virtual void WriteSyntax(ISyntax Syntax) |
|
|
protected virtual void WriteSyntax(object Data) |
|
|
protected virtual object ToObject() |
|
|
protected virtual void WriteOperator(string Operator) |
|
|
protected virtual void WriteEqual(object value) |
|
|
protected virtual void Write(object value) |
|
|
protected virtual void Write(string value) |
|
|
protected virtual void Write(object Start,object End) |
|
|
protected virtual void Write(object[] List) |
|
|
protected virtual void WriteDelimiter() |
|
|
protected virtual void WriteBegin() |
|
|
protected virtual void WriteEnd() |
|
|
protected virtual void WriteExpression(string Expression,params object[] Params) |
|
|
protected virtual void WriteMethod(string Name,params object[] Params) |
|
|
int ISyntax.Max |
|
|
Type ISyntax.Class |
|
|
void IFilter.And() |
|
|
void IFilter.Or() |
|
|
void IFilter.Not() |
|
|
void IFilter.Xor() |
|
|
void IFilter.Search(string Name,string Operator,object value) |
|
|
void IFilter.Search(string Name,object value) |
|
|
void IFilter.Search(object Instance) |
|
|
void IFilter.Like(string Name,string value) |
|
|
void IFilter.Between(string Name,object Start,object End) |
|
|
void IFilter.In(string Name,params object[] Params) |
|
|
void IFilter.Filter(string Filter,params object[] Params) |
|
|
void IFilter.Exists(Type Class,string Filter,params object[] Params) |
|
|
void IFilter.Exists(object Syntax) |
|
|
void IFilter.IN(string Name,Type Class,string Member,string Filter,params object[] Params) |
|
|
void IFilter.IN(string Name,object Syntax) |
|
|
void IFilter.Order(string Name,bool Asc) |
|
|
void IFilter.Order(string Name) |
|
|
void ISyntax.Select(Type Class,params string[] Members) |
|
|
void ISyntax.Update(object Instance,params string[] Members) |
|
|
void ISyntax.Insert(object Instance,bool All) |
|
|
void ISyntax.Delete(Type Class) |
|
|
void ISyntax.Call(Type Class, object Method,params object[] Params) |
|
|
void ISyntax.Inner(string Entity,string Filter) |
|
|
void ISyntax.Left(string Entity,string Filter) |
|
|
void ISyntax.Right(string Entity,string Filter) |
|
|
void ISyntax.Group(string Name) |
|
|
void ISyntax.Filter(IFilter Filter) |
|
|
} |
|
|
|
//The persistent objects repository |
|
public class Repository |
|
{ |
|
public static void Open(string Class,string Connection,int Pool,string LogDir) |
|
|
public static EventLog Event(string Name,Type Class) |
|
|
public static ISyntax Syntax() |
|
|
public static ISyntax Syntax(Type Class,int Max) |
|
|
public static ISyntax Syntax(Type Class) |
|
|
public static IFilter Filter(Type Class,int Max) |
|
|
public static IFilter Filter(Type Class) |
|
|
public static IFilter Filter() |
|
|
public static object Covert(object value,Type Class) |
|
|
public static object Reload(object Instance) |
|
|
public static object[] All(Type Class) |
|
|
public static object Lookup(object Instance) |
|
|
public static object Lookup(Type Class,object ID) |
|
|
public static object Lookup(IFilter Filter) |
|
|
public static object Lookup(Type Class, string Filter,string Order,params object[] Params) |
|
|
public static object Lookup(IList List,IFilter Filter) |
|
|
public static object Lookup(Type ListType,IFilter Filter) |
|
|
public static object Lookup(IDictionary Dictionary,string Key,IFilter Filter) |
|
|
public static object Lookup(Type DictionaryType,string Key,IFilter Filter) |
|
|
public static object Lookup(object Instance,string Member) |
|
|
public static bool Exists(IFilter Filter) |
|
|
public static bool Exists(Type Class,string Filter,params object[] Params) |
|
|
public static object Call(Type Class,object Method,params object[] Params) |
|
|
public static void Store(object Instance) |
|
|
public static void Update(object Instance) |
|
|
public static void Update(object Instance,string Members,string Filter,params object[] Params) |
|
|
public static void Update(object Instance,string Members,IFilter Filter) |
|
|
public static void Remove(object Instance) |
|
|
public static void Remove(Type Class,string Filter,params object[] Params) |
|
|
public static void Remove(Type Class,IFilter Filter) |
|
|
} |
|
|
|
//The
events logger class |
|
public class EventLog |
|
{ |
|
public void WriteBegin(string Event,Type Class) |
|
|
public void WriteLine(params object[] Tokens) |
|
|
public void WriteException(Exception Error) |
|
|
public void WriteEnd() |
|
|
public override string ToString() |
|
|
} |
|
|
|
//Any
storage providers interface base |
|
public interface IStorage |
|
{ |
|
ISyntax Syntax |
|
|
EventLog Event |
|
|
bool Exists(); |
|
bool Read(); |
|
bool IsValid(int Index); |
|
object this[int Index,Type Type] |
|
|
void Store(); |
|
void OnRelease(); |
|
void Close(); |
|
} |
|
|
|
//Storage factory internal class |
|
public class Factory : System.Collections.Stack |
|
{ |
|
public Factory(Type Class,string Connection,int Pool) |
|
|
public IStorage Create() |
|
|
public void Release(IStorage Storage) |
|
|
public void Close() |
|
|
} |
|
|
|
//Xml formatter interface base |
|
public interface IXmlFormatter |
|
{ |
|
void Serialize(System.Xml.XmlWriter writer, object obj); |
|
object Deserialize(System.Xml.XmlReader reader); |
|
} |
|
|
|
//Xml formatter class |
|
public class XmlFormatter : IXmlFormatter |
|
{ |
|
public static void SaveTo(string FileName,object obj) |
|
|
public static object LoadFrom(string FileName) |
|
|
public XmlFormatter(object XmlData) |
|
|
string override ToString() |
|
|
void virtual FromString(string value) |
|
|
void IXmlFormatter.Serialize(XmlWriter writer, object obj) |
|
|
object IXmlFormatter.Deserialize(XmlReader reader) |
|
|
} |