Contact

Feel free to use the form below to post any comments, questions, or suggestions about this blog.

If you have questions regarding NLog, please use NLog Forum instead.

  1. #1 written by Oisin Mac Giolla Chuda May 6th, 2010 at 06:44

    I love your providers, i am using them in my app at the moment and they save me lots of time so well done. Just one thing, I downloaded the latest .Net 4 version and when I try to compile it crashes VS2010 every time, it is a release candidate, but just wondering if anyone else had this problem or if it is machine-specific? Keep up the good work

    RE Q
  2. #2 written by Justin Davis May 15th, 2010 at 03:27

    I read your post about you being the only active contributer on nLog.
    Is there anything I can do to help out?

    RE Q
  3. #3 written by Carlos May 21st, 2010 at 11:06

    Hi Jaroslaw,

    Do you know how can I retrieve the generated SQL code to be executed during a SaveChanges? I found on the web how to see the query generated SQL using ObjectQuert.ToTraceString method. But I haven’t found a way to debug the SQL generated for SaveChanges method. Do you have any idea about how I can accomplish it?
    I’m using your Oracle sample provider with some modifications (using ODP.NET) as underling database and the sample provider. I know I can debug to check the generated SQL statement, but is there a simpler way?

    Thanks in advance,
    Carlos Loth.

    RE Q
  4. #4 written by Jarek Kowalski May 21st, 2010 at 11:13

    Carlos,

    You can use EF Provider Wrappers for that:

    http://jkowalski.com/2010/04/15/new-version-of-efproviderwrappers-released/

    Jarek

    RE Q
  5. #5 written by Wes June 22nd, 2010 at 01:05

    I can’t get tracing to work with the latest release. I replaced the object context with my own

    internal partial class ExtendedMyConnection : MyConnection
    {
    private TextWriter logOutput;

    public ExtendedMyConnection()
    : this(“name=MyConnection”)
    {
    }

    but it keeps bailing out with error 1075 when the default constructor is invoked:

    System.Data.MetaDataException
    Schema specified is not valid. Errors: \r\n(0,0) : error 0175: The specified store provider cannot be found in the configuration, or is not valid.

    The offending line is

    StoreItemCollection sic = new StoreItemCollection(ssdl.Select(c => c.CreateReader()));

    in CreateWrappedMetadataWorkspace. I examined local variables (it finds the connection string from the app.config just fine) but have no clue where the actual problem may lie.

    RE Q
  6. #6 written by Walter Oesch July 21st, 2010 at 04:11

    Hello Jarek

    I found your EF cache provider in the internet. This provider seems very interesting to me. However, I do not really understand how it works from a user’s point of view. Below I list my core requirements I have for a cache provider. Could you please tell me if your provider can handle this requirements?

    - Cache provider should be able to cache entities that most likely will never change, like states and so on. It should always be possible to access these cached entities.

    - I should be able to tell the cache provider when to cache entities or queries
    - It should be possible to access cached entites without inserting new entities in the cache

    My main concern is that I am not able to tell the cache provider which entities shoudl be cached. Consider the example of customer having a state. When I ask for a state, it should always come from the cache. When I ask for a customer on the other hand I would like to always get a fresh customer, unless, in the ideal world, it is already loaded in the current context.

    I would appreciate if very much if you could answer my question. Perhaps you can send me some client code snipped how your cache provider has to be used to perform in the way I would like it to do or send my a link to some other ressources.

    Best regards,
    Walter

    RE Q
  7. #7 written by Perry July 30th, 2010 at 14:12

    Typo on NLog webpage:

    On page: http://nlog-project.org/wiki/.NET_Logging_API

    The last line says: Full list of members of the Logger class can be found here.

    but the word “here” is just a text word — the hyperlink is missing; obviously it was meant to be linked to something.

    RE Q
  8. #8 written by Craig August 12th, 2010 at 01:58

    I am trialling the EF Provider Wrappers as I am very interested in the caching wrapper. It works well, probably too well. I would like to be able to set cache duration in a CustomCachingPolicy as the CacheAll option does not pick up changes to data in the underlying data store that are made outwith the EF. Is this possible in the current release, or planned for the near future?

    RE Q
  9. #9 written by Markus Schmidt August 19th, 2010 at 06:16

    Thank you very much for EFProviderWrappers, very nice piece of work!

    I added the EFCachingProvider component to a .NET 4 ASP.NET app, and it does exactly what I expected a generic caching layer to do. Well, almost: Whenever SaveChanges gets called in the scope of a transaction, no cache items will be invalidated, and queries will return outdated data.

    I can see that there seems to be explicit support for transactions in the source code, e. g. the EFCachingTransaction class and many more references. However I’m not sure if this should just work “under the hood” and I’m experiencing some sort of bug, or I need to change something in my code to make it work.

    This is basically what I’m doing:

    using (var db = new ExtendedMyProjectEntities())
    {
    // … add or load/modify data
    using (TransactionScope tx = new TransactionScope())
    {
    db.SaveChanges();
    tx.Complete();
    }
    }

    In my extended entity class there is no explicit mentioning of transactions (like in the AspNetCachingDemo project).

    Thank you very much in advance! Actually, without this caching layer, Entity Framework would be of very limited use for larger web applications.

    RE Q
  10. #10 written by Frank Franz August 19th, 2010 at 22:11

    This caching project will live on in obscurity until actual documentation is written. Maybe it does everything you could ever want, but without looking through the sample website code to see what it can do, you’d never know, which 99.99% of people aren’t going to do.

    RE Q
  11. #11 written by Mikhail Merkulov September 14th, 2010 at 06:12

    Hi,

    I’m using the Tracing and Caching Provider Wrappers for Entity Framework and I have some comments.

    1. It would be greate to log query start time and duration in the CommandExecutionEventArgs.ToTraceString method.

    2. Why the CreateDbCommand method of the DbConnectionWrapper class throws NotSupported exception? Why don’t you return this.wrappedConnection.CreateCommand();

    Thanks a lot for great samples.

    RE Q
  12. #12 written by Keith Tobin September 15th, 2010 at 05:55

    This is something that I wanted for a long time, and I must say good job.
    My question is did you design the cache part as a type of provider where
    the cache backend could be changed from memory to say something like memcache from http://www.memcache.org. My reason for asking is that for web
    app’s like ours I would like to use a cache backend that can be accessed by
    more then one instance of the same web app on azure.

    Thanks Keith……………

    RE Q
  13. #13 written by jycouet September 16th, 2010 at 23:48

    Hi,
    I just discover [Tracing and Caching Provider Wrappers for Entity Framework] and I find it great !!!

    I just have a question. I enable the caching part with EFCachingProviderConfiguration.DefaultCache = new AspNetCache(); And everything work fine, some data are in the cache and stuff…

    But, if I go in the database and update a field directly, my Web application continue to look in the cache… So, did I miss something ? Or can we force to remove the case, or a part of the cache? Or something ?

    Thank you to help me.

    Jean-Yves

    RE Q
  14. #14 written by Jean-Yves COUET September 19th, 2010 at 00:10

    Hi,

    The caching is worjing perfectly in my website, insert, update…

    But, everyday at 4 in the morning, I have another programme witch update a lot of row in a table… I would like to reset this cache… Or that the cache take into account when the data base change out of the solution.

    Do i miss something or?

    Thank you

    RE Q
  15. #15 written by Vijendra Patil September 21st, 2010 at 06:24

    Hi Jarek,

    I was looking at the EFPocoAdapter. I am finding little difficulties in updating the Foreign Key of a table.

    I have 2 entity. (Bug (*-1)Module)

    Bug { int BugID, string Synopsis, Module ModuleRef}
    Module{int ModuleID, string ModuleName, List BugCollectionRef}

    Now whenever i need Bug entity i do.

    var bug = context.Bug.First(b => b.BugID == bugID);
    context.LoadProperty(bug, “Module”);

    /*
    If i say context.Bug.Detach(), the loaded Module property gets set to Null, so i dont detach the bug object
    */

    Now when i try to update the Module, say if i want to set the module of a Bug from “Test Module” to “New Module”, i am not able to do it. I am writing following code.

    var updatedBugObject = context.Bug.First(b => b.BugID == bugID);
    context.LoadProperty(updatedBugObject , “Module”);
    updatedBugObject.Module = GetNewModule(“New Module”);

    var originalBug = context.Bug.First(b => b.BugID == bugID);
    context.LoadProperty(originalBug , “Module”);
    context.Bug.Attach(originalBug);
    context.Bug.ApplyPropertyChanges(updatedBugObject);
    context.SaveChanges();

    How do i update the Foreign key.

    Though the original table Bug has FK moduleID defined , but when you associate a relation using Entity Framework, the EF designer asks you to Delete the “ModuleID” scalar property from the Bug entity, as the ModuleID can be accessed through the “ModuleRef” navigation property of the Bug Entity.

    Please let me know how to update the Foreign Key using the EFPocoAdapter for 1-* entity.

    Thanks,
    Vijendra

    RE Q
  16. #16 written by Tommy Newcomb September 24th, 2010 at 12:36

    I just wanted to add that I am using NLog on my commercial website: Verify History http://www.verifyhistory.com.
    It’s an automated background check site that uses XML web service to get the raw data.
    I just discovered NLog. After using Log4Net for years I can’t believe how awesome NLog is.
    It is amazingly powerful and you did a great job on NLog. Thanks.

    RE Q
  17. #17 written by Rafa Ortega October 6th, 2010 at 00:22

    Hi Jarek,

    I think I’ve found a bug in the EFProviderWrapperToolkit. The Code Gallery redirected me to this form to contact with you.

    The issue is in EntityConnectionWrapperUtils.cs, line 184.

    I’ve added the “&& !asm.IsDynamic” because this code was throwing an InvalidOperationException in the call to asm.GetManifestResourceStream. This method can be called against a dynamic assembly.

    foreach (Assembly asm in assembliesToConsider.Where(asm => !IsEcmaAssembly(asm) && !IsSystemAssembly(asm)
    && !asm.IsDynamic ))
    {
    using (Stream stream = asm.GetManifestResourceStream(resourceName)) // InvalidOperationException if asm is dynamic
    {
    if (stream == null)
    {
    continue;
    }

    Hope to be helpful.

    Rafa Ortega

    RE Q
  18. #18 written by Asgeir November 3rd, 2010 at 09:46

    Hi Jarek.

    Can you please supply me with a working silverligt example. With LogReciverTarget.
    I’v been looking at the examples you have in github, but it’s not working for me.
    If i try the example with logging to file,it’s working. but i need to use logReciverTarget.
    Adding nlog is my last workitem in a project i’m working on at work. I can send you my nlog test project code if it helps.

    RE Q
  19. #19 written by Andree Hagelstein November 15th, 2010 at 03:57

    I am coming from blackberry, hence i cannot use nlog forum.

    My question:

    If a use nlog on a Windows 2008 64 bit, the callsite layout logs an invalid entry. I think that the answer is the optimization for release code on 64 bit machines. To suppress this behaviour you can use this attribute:

    [MethodImpl(MethodImplOptions.NoInlining)]

    Also look at the following article:

    http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx

    Please give me an answer for this way to fix the issue.

    Thanks (also for the great NLog!)

    Andree Hagelstein

    RE Q
  20. #20 written by Robert November 17th, 2010 at 21:10

    I have found.. what i think to be a bug.. in the latest release of EFWrapperProvider for EF4. If i am using a SPROC for an update/delete/insert operation of an entity and I am using the EFWrapperProvider i get an exception thrown.

    In DbConnectionWrapper.CreateDbCommand you currently throw a
    NotSupportedException().
    In the previous version of EFWrapperProvider this was instead
    return this.wrappedConnection.CreateCommand()

    After changing the new method to work the same way as the old method i no longer got the exception and it all seemd to work fine. Is this exception being thrown by design or was it just missed? If it is meant to do this then whats the reasoning behind it.

    Great project anyways.
    Thanks,
    Rob

    RE Q
  21. #21 written by Paul Johnson November 18th, 2010 at 04:33

    Jarek

    Wondered if you might be able to solve a problem for me. I have recently moved to your NLog framework initial impressions are quite frankly excellent!, much easier to get up and running than Log4Net. However having managed a fairly simple config based implementation, I need to fine tune things a bit, specifically this means providing layouts, conditional to each loglevel. Have looked at using ‘Filtering Wrappers’ for this purpose as detailed below:

    Thus far have been unable to get this to supply the functionality that I need. Am I on the correct path here? If so could you point out where I am going wrong, or alternatively if I am barking up the completely incorrect tree let me know what I should be doing.

    Kind Regards

    Paul J.

    RE Q
  22. #22 written by steve frierdich December 3rd, 2010 at 13:46

    Your article titled
    Tracing and Caching Provider Wrappers for Entity Framework
    saids it works with entity framework 4.0.
    We are still on Framework 3.5. Do you have any sample code for Tracing and Caching Provider Wrappers for Entity Framework 3.5?

    Thanks you

    RE Q
  23. #23 written by Justin Davis December 3rd, 2010 at 15:09

    Jarek,
    I am using the preview nLog 2.0 in silverlight and getting a security error trying to set “myfileTarget.FileName = “${specialfolder:MyDocuments}/log.${shortdate}.txt”"

    File operation not permitted. Access to path ” is denied.

    Windows7 32Bit
    VS2010 net 4 framework

    RE Q
  24. #24 written by Jeff January 5th, 2011 at 09:53

    Jarek,
    I was wondering if it’s possible to use EFCachingProvider with EF CTP5/DbContext and if yes, how?

    Any insight is appreciated

    RE Q
  25. #25 written by Scott Beardsley January 26th, 2011 at 12:38

    Hello Jarek,

    I found the EFProviderWrappers project yesterday and have been testing it with AppFabric Caching (Velocity) as a Cache-Through provider. One thing I noticed was with ambient transactions via TransactionScope, Cache.InvalidateSets() never gets called.

    It appears that the underlying SQLConnection is enlisting in the ambient transaction, however the DBConnectionWrapper.EnlistTransaction never gets called.

    After some digging, I think I have come up with a solution to the problem. However I haven’t ever touched this part of the framework before and I am curious if this is the proper way to solve the problem.

    You can see the gist of my code additions at https://gist.github.com/797390

    Basically in EFCachingConnection.Open, I enlist in the ambient transaction using a custom IEnlistmentNotification (EFCachingEnlistment) that does the same thing as the EFCachingTransaction.

    The EFCachingCommand updates the CachingEnlistment when one exists on the EFCachingConnection… the same way it would if the EFCachingTransaction existed.

    Thanks in advance, and feel free to use this code to add the functionality to the EFCachingProvider. Also if I am doing something completely wrong, please let me know.

    Thanks,
    Scott Beardsley

    RE Q
  26. #26 written by Ronny E. Mathiasen February 1st, 2011 at 13:53

    Hi Jarek,

    I have a quick question for you.
    I just recently started digging in to EF 4.0 and needed some logging/tracing capabilities. I came across EFTracingProvider witch looks great but unfortunately not working for me.

    My question is therefore: is it still needed to use EFTracingProvider for tracing or have I missed some built in feature of EF 4.0 that does the same?

    Thanks and regards,
    Ronny

    RE Q
  27. #27 written by Ronny E. Mathiasen February 1st, 2011 at 13:55

    Sorry if this is a double post, but I didn’t see any confimation that my message was sent ;)

    Hi Jarek,

    I have a quick question for you.
    I just recently started digging in to EF 4.0 and needed some logging/tracing capabilities. I came across EFTracingProvider witch looks great but unfortunately not working for me.

    My question is therefore: is it still needed to use EFTracingProvider for tracing or have I missed some built in feature of EF 4.0 that does the same?

    Thanks and regards,
    Ronny

    RE Q
  28. #28 written by Marty Tippin February 26th, 2011 at 20:19

    Your original blog post regarding the EFCachingProvider mentions that the custom caching policy can specify cache expiration but I see no public means of achieving that using the custom caching policy.

    Am I missing something or is that capability not implemented?

    Thanks

    RE Q
  29. #29 written by Dwight Smith March 6th, 2011 at 12:43

    Do you have any documentation about how to configure EF Tracing and Caching wrappers when your model is in a separate class library from your application code? When I tried to follow your config docs, I ended up getting no errors, but also getting no data!

    Thanks much.

    RE Q
  30. #30 written by Bruno Nogueira March 25th, 2011 at 04:43

    Hi,

    I found 2 possible bugs in the EF Wrapper 1.02.

    1. From time to time I am getting an exception on this line from the EntityConnectionWrapperUtils:
    var storeConnection = DbProviderFactories.GetFactory(ecsb.Provider).CreateConnection();

    Exception:
    System.Web.HttpUnhandledException (0×80004005): Exception of type ‘System.Web.HttpUnhandledException’ was thrown. —> System.ArgumentException: An item with the same key has already been added.
    at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
    at EFProviderWrapperToolkit.EntityConnectionWrapperUtils.CreateEntityConnectionWithWrappers(String entityConnectionString, String[] wrapperProviders) in C:\Users\Bruno\Downloads\EF4ProviderWrappers\EF4ProviderWrappers\EFProviderWrapperToolkit\EntityConnectionWrapperUtils.cs:line 58

    2. The InMemoryCache, unlike AspNetCache, doesnt do a Hash on the key before adding it to the cache, so big SQL are not being added to the cache. My idea would be use MemoryCache from 4.0, or hash the sql before adding it to the cache.

    Please, let me know if you need further explanation.

    Thanks

    RE Q
  31. #31 written by Andras Galli May 21st, 2011 at 12:18

    Hello Jarek!

    I’ve started to use your EFProviderWrapper in a Windows Service application. The app creates WCF interfaces, and a cliens can ask, and send data to the app. When a client send something, i write it to the database, and there is a method when i can ask back the stored values.
    My problem is, that after i insert a new value (with LINQ), it appears in the database, but when i try to query it with a LINQ expression, is gives back the cached data, but without the newly inserted value.
    Do you have any idea, why i can’t get back the new value, just after restarting my application?

    Thank you!

    Regards!

    RE Q

SetPageWidth