SQLite With Open Access Problem

2 posts, 0 answers
  1. zenus
    zenus avatar
    5 posts
    Member since:
    Apr 2011

    Posted 09 Aug 2011 Link to this post


    I have tried to link my data model with SQLite database using configuration file and it works fine but i faced this problem.
    When i tried an example of the data model (Classes) and data access layer the in same project it works fine, but when i separated the data model in a class library it always gives this error when i tried to get the Scope:

    theObjectScopeProvider1.myScope = GetNewObjectScope();
    // The Error  : Could not load file or assembly 'System.Data.SQLite'

    I added the reference of 'System.Data.SQLite' to class library as usual and it was working when i convert the project from class library to Console application and invoke the scope.
    By the way i tried to load the assembly dynamically from the AdjustForDynamicLoad function but nothing changed:
    static public void AdjustForDynamicLoad()
                Assembly SQLiteAssembly = Assembly.LoadFile(@"C:\Lib\System.Data.SQLite.DLL");
                if( theObjectScopeProvider1 == null )
                    theObjectScopeProvider1 = new ObjectScopeProvider1();
                if( theObjectScopeProvider1.myDatabase == null )
                    string assumedInitialConfiguration =
                               "<openaccess>" +
                                   "<references>" +
                                       "<reference assemblyname='PLACEHOLDER' configrequired='True'/>" +
                                       "<reference assemblyname='PLACEHOLDEZ' configrequired='False'/>" +
                                   "</references>" +
                    System.Reflection.Assembly dll = theObjectScopeProvider1.GetType().Assembly;
                    assumedInitialConfiguration = assumedInitialConfiguration.Replace("PLACEHOLDER", dll.GetName().Name);
                    //assumedInitialConfiguration = assumedInitialConfiguration.Replace("PLACEHOLDEZ", SQLiteAssembly.GetName().Name);
                    System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
                    Database db = Telerik.OpenAccess.Database.Get("SQLiteDatabaseConnection",
                                                new System.Reflection.Assembly[] { dll, SQLiteAssembly. } );
                    theObjectScopeProvider1.myDatabase = db;
    So, the problem is how to add reference or assembly to the scope.

    Thanks in advance.
  2. zenus
    zenus avatar
    5 posts
    Member since:
    Apr 2011

    Posted 09 Aug 2011 Link to this post

    Sorry I posted in wrong forum, i moved it to: ORM > General  Discussion / Developer Productivity Tools Forums / OpenAccess ORM > General Discussions >
Back to Top