Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / OpenAccess ORM > OpenAccess ORM Free Edition > Fluent Config, Medium Trust, Metadata.Inflector

Not answered Fluent Config, Medium Trust, Metadata.Inflector

Feed from this thread
  • Bitsmith avatar

    Posted on Oct 29, 2011 (permalink)

    Hi,

    I'm using OA with fluent mapping - which is a nice feature.   It works great in dev mode.

    But I'm running into a security issue when I run it in a medium trust environment.

    I have no need for the features that inflection provides (which appears to be the source of the problem).  Is there a possible work-around for this?

    --------------------------------
    The exception and stack traces are below:

    --- The error showing on the view...:

    [SecurityException: Request for the permission of type 'System.Security.Permissions.RegistryPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
       System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
       System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission cap, StackCrawlMark& stackMark) +31
       System.Security.CodeAccessPermission.Demand() +46
       Microsoft.Win32.RegistryKey.CheckPermission(RegistryInternalCheck check, String item, Boolean subKeyWritable, RegistryKeyPermissionCheck subKeyCheck) +9629534
       Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +70
       Microsoft.Win32.RegistryKey.OpenSubKey(String name) +6
       Telerik.OpenAccess.Metadata.Inflector.GetInstallDir() +135
       Telerik.OpenAccess.Metadata.Inflector..cctor() +2465
     


    --- Inner exception when debugging...:
    Exception: The type initializer for 'Telerik.OpenAccess.Metadata.Inflector' threw an exception.

    Stack Trace:
       at Telerik.OpenAccess.Metadata.Inflector.Camelize(String lowercaseAndUnderscoredWord)
       at Telerik.OpenAccess.Metadata.DefaultNamingStrategy.ApplyNamingRules(NamingRules rules, String newPropertyName)
       at Telerik.OpenAccess.Metadata.Fluent.PropertyConfiguration.GetFieldName()
       at Telerik.OpenAccess.Metadata.Fluent.PropertyConfiguration.get_FieldName()
       at Telerik.OpenAccess.Metadata.Fluent.PropertyConfiguration.GetMemberType()
       at Telerik.OpenAccess.Metadata.Fluent.PropertyConfiguration.AddConceptualItem(FluentMetadataSource fluentMappingSource, MetaPersistentType persistentType)
       at Telerik.OpenAccess.Metadata.Fluent.MappingConfiguration.AddSlaveAssociationMapping(FluentMetadataSource fluentMappingSource, MetadataContainer metadataContainer)
       at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.CreateModel()
       at Telerik.OpenAccess.Metadata.Fluent.FluentMetadataSource.GetModelCore(MetadataContainer model)
       at Telerik.OpenAccess.Metadata.MetadataSource.GetModel()
       at Telerik.OpenAccess.OpenAccessContextBase.GetMetadataContainerFromSource(MetadataSource metadataSource)
       at Telerik.OpenAccess.OpenAccessContextBase..ctor(String connectionString, BackendConfiguration backendConfiguration, MetadataSource metadataSource, Assembly callingAssembly)
       at Telerik.OpenAccess.OpenAccessContext..ctor(String connectionString, BackendConfiguration backendConfiguration, MetadataSource metadataSource)

    Reply

  • Serge Serge admin's avatar

    Posted on Nov 2, 2011 (permalink)

    Hi Bitsmith,

     It looks as a bug on our side, we will continue digging in and most probably fix this issue for the upcoming Q3 release. However for the time being there is an easy solution to your problem and that would be to just explicitly specify the field names for all properties. (You can do this by using syntax much like configuration.HasProperty(...).HasFieldName(string)). Another solution would be to switch to auto properties.

    Any of these solution would lead to the Inflector not be used because there will be no need to calculate the field name. 

    I hope this is helpful, please do find your Telerik point updated for reporting this issue.

    Best wishes,
    Serge
    the Telerik team
    Want to use Telerik OpenAccess with SQL Azure? Download the trial version today. 

    Reply

  • Bitsmith avatar

    Posted on Nov 12, 2011 (permalink)

    Thanks for your response.

    How would I "switch to Auto Properties"?
    It's not easy to find in the documentation.

    Reply

  • Serge Serge admin's avatar

    Posted on Nov 14, 2011 (permalink)

    Hi Bitsmith,

     I am sorry for not making myself clear, by auto-properties I meant auto-implemented properties. When those are used the field name is not calculated and can be inferred directly thus working around the current issue. Of course it will require a bit of coding on your side, but it should be pretty straightforward and easy.

    I hope this is helpful. Please keep in mind that the fix for your issue will be available shortly as we will be shipping out the new Q3 release by the end of the week. 

    Greetings,
    Serge
    the Telerik team
    Want to use Telerik OpenAccess with SQL Azure? Download the trial version today. 

    Reply

  • Bitsmith avatar

    Posted on Nov 14, 2011 (permalink)

    The original error posted was a scenario where all the class's properties had used the auto-implement approach you referenced.
    So I don't see that as a fix.

    I also tried refactoring the class properties to have backing fields and made the appropriate additions in the metadatasource... still running into issues.

    Looking forward to the fix in the Q3 release.

    Thank you for your help so far.

    Reply

  • Serge Serge admin's avatar

    Posted on Nov 17, 2011 (permalink)

    Hi Bitsmith,

     Are you sure that all of the properties were actually auto-properties, from the call stack I can see that you get the exception in a method that is only called if there are properties that are fully defined. Maybe there was a single property that was fully defined that lead to this behaviour. 

    I am writing to let you know that yesterday we published the Q3 release of OpenAccess that contains the fix for your issue. 

    Do not hesitate to let us know if you face further trouble.

    Kind regards,
    Serge
    the Telerik team
    Want to use Telerik OpenAccess with SQL Azure? Download the trial version today. 

    Reply

  • Bitsmith avatar

    Posted on Nov 18, 2011 (permalink)

    Ah.
    There is a possibility that one or a few properties across the many classes were not declared properly.

    I've tried it with the latest update and it works.

    Thanks a lot!!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / OpenAccess ORM > OpenAccess ORM Free Edition > Fluent Config, Medium Trust, Metadata.Inflector