Exemplo n.º 1
0
        /// <summary>
        /// Adjusts for dynamic loading when no entry assembly is available/configurable.
        /// </summary>
        /// <remarks>
        /// When dynamic loading is used, the configuration path from the
        /// applications entry assembly to the connection setting might be broken.
        /// This method makes up the necessary configuration entries.
        /// </remarks>
        public static void AdjustForDynamicLoad()
        {
            if( theObjectScopeProvider == null )
                theObjectScopeProvider = new ORM();

            if( theObjectScopeProvider.mesDatabase == null )
            {
                string assumedInitialConfiguration =
                           "<openaccess>" +
                               "<references>" +
                                   "<reference assemblyname='PLACEHOLDER' configrequired='True'/>" +
                               "</references>" +
                           "</openaccess>";
                System.Reflection.Assembly dll = theObjectScopeProvider.GetType().Assembly;
                assumedInitialConfiguration = assumedInitialConfiguration.Replace(
                                                    "PLACEHOLDER", dll.GetName().Name);
                System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                xmlDoc.LoadXml(assumedInitialConfiguration);
                Database db = Telerik.OpenAccess.Database.Get("MESDatabaseConnection",
                                            xmlDoc.DocumentElement,
                                            new System.Reflection.Assembly[] { dll } );

                theObjectScopeProvider.mesDatabase = db;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the instance of Database for the connectionId
        /// specified in the Enable Project Wizard.
        /// </summary>
        /// <returns>Instance of Database.</returns>
        /// <remarks></remarks>
        static public Database Database()
        {
            if (theObjectScopeProvider == null)
            {
                theObjectScopeProvider = new ORM();
            }

            if (theObjectScopeProvider.mesDatabase == null)
            {
                theObjectScopeProvider.mesDatabase = Telerik.OpenAccess.Database.Get("MESDatabaseConnection");
            }

            return(theObjectScopeProvider.mesDatabase);
        }
Exemplo n.º 3
0
 protected Service()
 {
     // Always return New object scope ensure that not object access between different service.
     objScope = ORM.GetNewObjectScope();
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns the instance of Database for the connectionId 
        /// specified in the Enable Project Wizard.
        /// </summary>
        /// <returns>Instance of Database.</returns>
        /// <remarks></remarks>
        public static Database Database()
        {
            if( theObjectScopeProvider == null )
                theObjectScopeProvider = new ORM();

            if( theObjectScopeProvider.mesDatabase == null )
                theObjectScopeProvider.mesDatabase = Telerik.OpenAccess.Database.Get( "MESDatabaseConnection" );

            return theObjectScopeProvider.mesDatabase;
        }