public static int InitializeDatabaseContext() { cMenu.Metaobjects.Linq.CMetaobject M = new cMenu.Metaobjects.Linq.CMetaobject(); cMenu.Security.Linq.CSecuredMetaobject SM = new cMenu.Security.Linq.CSecuredMetaobject(); cMenu.Metaobjects.Extended.Linq.CMetaobjectExtented ME = new cMenu.Metaobjects.Extended.Linq.CMetaobjectExtented(); var Asm = Assembly.LoadWithPartialName("cMenu.Resources"); var S = Asm.GetManifestResourceStream("cMenu.Resources.LinqMapping.xml"); TextReader R = new StreamReader(S); var XML = R.ReadToEnd(); XmlMappingSource mapping = XmlMappingSource.FromXml(XML); DatabaseContext = new DataContext("Data Source=.\\;Initial Catalog=DB_CMENU;User Id=sa;Password=Qwerty1;", mapping); return CErrors.ERR_SUC; }
public static CMetaobject sGetObjectByID(Guid ID, DataContext Context) { CMetaobject R = new CMetaobject(Context); R.ID = ID; R.ObjectGetByID(Context); return (R.Key == CDBConst.CONST_OBJECT_EMPTY_KEY ? null : R); }
public static CMetaobject sGetObjectByKey(decimal Key, DataContext Context) { CMetaobject R = new CMetaobject(Context); R.Key = Key; R.ObjectGetByKey(Context); return (R.ID == Guid.Empty ? null : R); }
public CMetaobject GetLinkedObject(DataContext Context) { CMetaobject R = new CMetaobject(this._linkedObjectKey, Context); return (R.ID == Guid.Empty ? null : R); }