This question is locked. New answers and comments are not allowed.
Hi, My application is very slow. I think I am using wrong way.. please see below.
here is my ScopeProvider class...
public class DataCuesORMScopeProvider : IObjectScopeProvider
{
private Database myDatabase;
private IObjectScope myScope;
static private DataCuesORMScopeProvider theObjectScopeProvider1;
/// <summary>
/// Constructor.
/// </summary>
/// <remarks></remarks>
public DataCuesORMScopeProvider()
{
}
static public void AdjustForDynamicLoad()
{
if( theObjectScopeProvider1 == null )
theObjectScopeProvider1 = new DataCuesORMScopeProvider();
if( theObjectScopeProvider1.myDatabase == null )
{
string assumedInitialConfiguration =
"<openaccess>" +
"<references>" +
"<reference assemblyname='PLACEHOLDER' configrequired='True'/>" +
"</references>" +
"</openaccess>";
System.Reflection.Assembly dll = theObjectScopeProvider1.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("SciensORMConnection",
xmlDoc.DocumentElement,
new System.Reflection.Assembly[] { dll } );
theObjectScopeProvider1.myDatabase = db;
}
}
static public Database Database()
{
if( theObjectScopeProvider1 == null )
theObjectScopeProvider1 = new DataCuesORMScopeProvider();
if( theObjectScopeProvider1.myDatabase == null )
theObjectScopeProvider1.myDatabase = Telerik.OpenAccess.Database.Get( "SciensORMConnection" );
return theObjectScopeProvider1.myDatabase;
}
static public IObjectScope ObjectScope()
{
Database();
if( theObjectScopeProvider1.myScope == null )
theObjectScopeProvider1.myScope = GetNewObjectScope();
return theObjectScopeProvider1.myScope;
}
static public IObjectScope GetNewObjectScope()
{
Database db = Database();
IObjectScope newScope = db.GetObjectScope();
return newScope;
}
}
and I am using follwing way to fetch the records..
var contract = DataCuesORMScopeProvider.Database().GetObjectScope().GetOqlQuery<VARMSContract>().ExecuteList().Where(c => c.ContractID == ContractID).First();
is it write method to run the query??
please suggest
Thanks
here is my ScopeProvider class...
public class DataCuesORMScopeProvider : IObjectScopeProvider
{
private Database myDatabase;
private IObjectScope myScope;
static private DataCuesORMScopeProvider theObjectScopeProvider1;
/// <summary>
/// Constructor.
/// </summary>
/// <remarks></remarks>
public DataCuesORMScopeProvider()
{
}
static public void AdjustForDynamicLoad()
{
if( theObjectScopeProvider1 == null )
theObjectScopeProvider1 = new DataCuesORMScopeProvider();
if( theObjectScopeProvider1.myDatabase == null )
{
string assumedInitialConfiguration =
"<openaccess>" +
"<references>" +
"<reference assemblyname='PLACEHOLDER' configrequired='True'/>" +
"</references>" +
"</openaccess>";
System.Reflection.Assembly dll = theObjectScopeProvider1.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("SciensORMConnection",
xmlDoc.DocumentElement,
new System.Reflection.Assembly[] { dll } );
theObjectScopeProvider1.myDatabase = db;
}
}
static public Database Database()
{
if( theObjectScopeProvider1 == null )
theObjectScopeProvider1 = new DataCuesORMScopeProvider();
if( theObjectScopeProvider1.myDatabase == null )
theObjectScopeProvider1.myDatabase = Telerik.OpenAccess.Database.Get( "SciensORMConnection" );
return theObjectScopeProvider1.myDatabase;
}
static public IObjectScope ObjectScope()
{
Database();
if( theObjectScopeProvider1.myScope == null )
theObjectScopeProvider1.myScope = GetNewObjectScope();
return theObjectScopeProvider1.myScope;
}
static public IObjectScope GetNewObjectScope()
{
Database db = Database();
IObjectScope newScope = db.GetObjectScope();
return newScope;
}
}
and I am using follwing way to fetch the records..
var contract = DataCuesORMScopeProvider.Database().GetObjectScope().GetOqlQuery<VARMSContract>().ExecuteList().Where(c => c.ContractID == ContractID).First();
is it write method to run the query??
please suggest
Thanks