This is a migrated thread and some comments may be shown as answers.

Enhancing and other dread stories

3 Answers 72 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gianni Araco
Top achievements
Rank 1
Gianni Araco asked on 27 Aug 2011, 10:22 AM
Greetings.
I'm in the process of evaluating OpenAccess ORM.The first test has been amazingly quick and neat, but as soon as I delved a bit deeper, troubles started.

The scenario is a multi-threaded Windows service, built with Visual Studio 2010 on .NET 4.0.
The OpenAccess version is the 2011.2.713.3 Trial.
The database is SQL Server 2008 R2.

There's a main project, that is the service and some libraries. A couple of them are "Telerik OpenAccess Class Library" projects.
The simplest one, is made by just one class and is used to log application informations into a database.

When I try to log infos into the database, I first got an error due to a transaction still active:

Not allowed because Commit / Rollback is in progress

using the private static LogModel _logContext = new LogModel("LogConnection"); and the associated SaveChanges().
Ok, the two calls come from two different threads.
If I have understood well, I need to do some configurations. After rummaging into the forums that's what I came up with:
<openaccess>
  <connections>
    <connection id="LogConnection">
      <databasename>Log</databasename>
      <servername>Server</servername>
      <user>sa</user>
      <password>sa</password>
      <backendconfigurationname>LogBackend</backendconfigurationname>
    </connection>
  </connections>
  <backendconfigurations>
    <backendconfiguration id="LogBackend" backend="mssql">
      <l2CacheEnabled>false</l2CacheEnabled>
      <l2QueryCacheEnabled>false</l2QueryCacheEnabled>
      <logging.logEvents>all</logging.logEvents>
      <logging.logEventsToSysOut>true</logging.logEventsToSysOut>
      <option.Multithreaded>true</option.Multithreaded>
    </backendconfiguration>
  </backendconfigurations>
</openaccess>

I thought this was enaugh, but.... now when I try to use the following code from within the Log project
IObjectScope o = Database.Get("LogConnection").GetObjectScope();

I get this nice error:

Telerik.OpenAccess: No enhanced assembly has been found for meta-data construction. This may be caused by a missing app.config file (use app.config as embedded resource then) or by an insufficient references section in the configuration file (add the referenced enhanced assemblies there too) or by a wrong enhancement setting; please check your configuration.

I tried manually setting the venhance post-build command, but nothing changed.
If I use the context, I sitll get the transaction error.

I went through a lot of threads and help links, but I'm still stuck there.

Could you gently give me some insight?

Thanks very much,
Gianni Araco


3 Answers, 1 is accepted

Sort by
0
Gianni Araco
Top achievements
Rank 1
answered on 30 Aug 2011, 09:26 AM
Ok, the problem about enhancing has been solved.
I just had to addthis string as a postbuild event (be mindful about the " if the path has spaces, or you'll get error 9009):
"C:\Program Files (x86)\Telerik\OpenAccess ORM\sdk\VEnhance.exe" -assembly:MyDLL.dll

not only for the data model project, but also for all the projects that uses the model.

As a note:
I don't know if it's necessary, but I also modified the file OpenAccess.targets in the sdk directory, as inside, in the tag
<OpenAccessPath Condition="'$(OpenAccessPath)'==''">C:\Program Files (x86)\Telerik\OpenAccess ORM</OpenAccessPath>
the path was set to C:\Program Files\Telerik\OpenAccess ORM, while have a 64bit system.

Now. One step ahead, but still one step behind.
In these few lines of code I get a new error:
IObjectScope o = Database.Get(LOG_CONNECTION).GetObjectScope();
o.Transaction.Begin();
o.Add(entry);
o.Transaction.Commit();

at the line o.Add(entry): Object reference not set to an instance of an object.
I've checked both the object o and the object entry and they are both created and filled with data.
The only thing that jumped to my eye, is that the property Log of the object scope, is null. Could it be the culprit?
If so, what should I do with it?

By the way, I can't find the Backend Configuration Wizard... is it time to change glasses?

Thanks.
Gianni Araco
0
Jan Blessenohl
Telerik team
answered on 31 Aug 2011, 02:00 PM
Hi Gianni Araco,
Sorry, we did some changes in the last year and it looks like you have updated from an older version. You can find some information in this blog post.

The Log is null because you have to set first. Can you give me the complete stack trace of your exception? The best would be an $exception.ToString(), that contains all data.

Best wishes,
Jan Blessenohl
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

0
Gianni Araco
Top achievements
Rank 1
answered on 12 Sep 2011, 10:58 AM
Greetings,
and sorry for the delay, but I was in abit of vacation in the meantime. :)

Anyway, the problem has been solved.
It took me some time to understand how to get the "old" menu back, and from there I configured the log parameters.
Now everything is working as intended.

Thank you very much.
Gianni Araco
Tags
General Discussions
Asked by
Gianni Araco
Top achievements
Rank 1
Answers by
Gianni Araco
Top achievements
Rank 1
Jan Blessenohl
Telerik team
Share this question
or