This question is locked. New answers and comments are not allowed.
Hi,
i just want to know how can I do to add the result of OQL result to a caontainer (with disconned mode) ?
Example of code with scope object :
==> but I want to use context database .... How can I do ?
In advance, thanks....
i just want to know how can I do to add the result of OQL result to a caontainer (with disconned mode) ?
Example of code with scope object :
==> but I want to use context database .... How can I do ?
In advance, thanks....
ObjectContainer.ChangeSet ccData = null;
IObjectScope os = ISSYS_Qualification_BO.ObjectScopeProvider.GetNewObjectScope();
os.Transaction.Begin();
try
{
string resultName = "User";
string query = "from u in this.Context.Users select u";
IQuery qry = os.GetOqlQuery(query);
IQueryResult qres = qry.Execute();
ObjectContainer oc = new ObjectContainer();
// default deep
Telerik.OpenAccess.IObjectCollector objCollector =
new FetchGroupCollector(FetchGroupCollector.DefaultFetchGroup);
if (qres != null)
{
try
{
int cnt = qres.Count;
oc.CopyFrom(os, resultName, qres, objCollector);
}
catch (Exception exc)
{
string msg = exc.Message;
oc.CopyFrom(os, resultName, qres, null);
}
}
else
oc.CopyFrom(os, resultName, qres, null);
ccData = oc.GetContent();
}
finally
{
os.Transaction.Rollback();
os.Dispose();
}
return ccData;