LinqPad

7 posts, 2 answers
  1. Michael
    Michael avatar
    29 posts
    Member since:
    Nov 2010

    Posted 03 Jun 2011 Link to this post

    Can we use LINQPad with OpenAccessORM, or is there any other app that can evulate LINQ query we write with OpenAccess ORM?
    I use OAORM with PostgreSQL.

    Michael.
  2. Michael
    Michael avatar
    29 posts
    Member since:
    Nov 2010

    Posted 03 Jun 2011 Link to this post

    I manage to setup environment in LinqPad, but i got this exception now :


    connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    In web.config I have connection string!


    Here is exception code :

    OpenAccessException

    System.Configuration.ConfigurationErrorsException: A connection string was referenced by name 'Connection' but could not be resolved through the web.c...

    InnerExceptions

    Exception [] (1 item)

    Message

    BareMessage

    Filename

    Line

    Errors

    Data

    InnerException

    TargetSite

    StackTrace

    HelpLink

    Source

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    null

    0

    ConfigurationException [] (1 item)

    Message

    BareMessage

    Filename

    Line

    Errors

    Data

    InnerException

    TargetSite

    StackTrace

    HelpLink

    Source

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    null

    0

    ConfigurationException [] (1 item)

    Message

    BareMessage

    Filename

    Line

    Errors

    Data

    InnerException

    TargetSite

    StackTrace

    HelpLink

    Source

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    null

    0

    ConfigurationException []

    IDictionary

    null

    null

    null

    null

    null

    IDictionary (0 items)

    null

    null

    null

    null

    null

    IDictionary (0 items)

    null

    RuntimeMethodInfo

    DBDriver.connect (ConnectionString connectionString, IDictionary driverProps)

    Name

    connect

    DeclaringType

    typeof (DBDriver)

    ReflectedType

    typeof (DBDriver)

    MemberType

    Method

    MetadataToken

    100664396

    Module

    RuntimeModule

    Telerik.OpenAccess.Adonet2.dll

    MDStreamVersion

    131072

    FullyQualifiedName

    C:\Windows\assembly\GAC_MSIL\Telerik.OpenAccess.Adonet2\2011.1.316.10__7ce17eeaf1d59342\Telerik.OpenAccess.Adonet2.dll

    ModuleVersionId

    e432a7a8-1f1e-4e22-9d04-c001112369a3

    MetadataToken

    1

    ScopeName

    Telerik.OpenAccess.Adonet2.dll

    Name

    Telerik.OpenAccess.Adonet2.dll

    Assembly

    RuntimeAssembly

    Telerik.OpenAccess.Adonet2, Version=2011.1.316.10, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342

    ModuleHandle

    ModuleHandle

    System.ModuleHandle

    IsSecurityCritical

    True

    IsSecuritySafeCritical

    True

    IsSecurityTransparent

    False

    MethodHandle

    RuntimeMethodHandle

    System.RuntimeMethodHandle

    Value

    IntPtr

    183572012

    Attributes

    PrivateScope, Public, Final, Virtual, HideBySig, VtableLayoutMask

    CallingConvention

    Standard, HasThis

    ReturnType

    typeof (Connection)

    ReturnTypeCustomAttributes

    RuntimeParameterInfo

    Telerik.OpenAccess.RT.sql.Connection

    ParameterType

    typeof (Connection)

    Name

    null

    DefaultValue

    null

    RawDefaultValue

    null

    MetadataToken

    134217728

    Position

    -1

    Attributes

    None

    Member

    RuntimeMethodInfo

    DBDriver.connect (ConnectionString connectionString, IDictionary driverProps)

    IsIn

    False

    IsOut

    False

    IsLcid

    False

    IsRetval

    False

    IsOptional

    False

    ReturnParameter

    RuntimeParameterInfo

    Telerik.OpenAccess.RT.sql.Connection

    ParameterType

    typeof (Connection)

    Name

    null

    DefaultValue

    null

    RawDefaultValue

    null

    MetadataToken

    134217728

    Position

    -1

    Attributes

    None

    Member

    RuntimeMethodInfo

    DBDriver.connect (ConnectionString connectionString, IDictionary driverProps)

    IsIn

    False

    IsOut

    False

    IsLcid

    False

    IsRetval

    False

    IsOptional

    False

    IsGenericMethod

    False

    IsGenericMethodDefinition

    False

    ContainsGenericParameters

    False

    IsPublic

    True

    IsPrivate

    False

    IsFamily

    False

    IsAssembly

    False

    IsFamilyAndAssembly

    False

    IsFamilyOrAssembly

    False

    IsStatic

    False

    IsFinal

    True

    IsVirtual

    True

    IsHideBySig

    True

    IsAbstract

    False

    IsSpecialName

    False

    IsConstructor

    False

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(ConnectionString connectionString, IDictionary driverProps)
       at OpenAccessRuntime.Relational.sql.SqlDriver.InitializeFor(String url, Boolean noConnect, PropertySet props, Driver& driver, Connection& conn)
       at OpenAccessRuntime.Relational.RelationalStorageManagerFactory..ctor(StorageManagerFactoryBuilder b)
       at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()

    null

    Telerik.OpenAccess.Adonet2

    FailedObject

    null

    BackendError

    null

    Reason

    Internal

    CanRetry

    False

    HelpLink

    null

    Message

    System.Configuration.ConfigurationErrorsException: A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.
       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(ConnectionString connectionString, IDictionary driverProps)
       at OpenAccessRuntime.Relational.sql.SqlDriver.InitializeFor(String url, Boolean noConnect, PropertySet props, Driver& driver, Connection& conn)
       at OpenAccessRuntime.Relational.RelationalStorageManagerFactory..ctor(StorageManagerFactoryBuilder b)
       at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()

    Data

    IDictionary (0 items)

    InnerException

    ConfigurationErrorsException

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    Message

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    BareMessage

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    Filename

    null

    Line

    0

    Errors

    ConfigurationException [] (1 item)

    Message

    BareMessage

    Filename

    Line

    Errors

    Data

    InnerException

    TargetSite

    StackTrace

    HelpLink

    Source

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    null

    0

    ConfigurationException [] (1 item)

    Message

    BareMessage

    Filename

    Line

    Errors

    Data

    InnerException

    TargetSite

    StackTrace

    HelpLink

    Source

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    A connection string was referenced by name 'Connection' but could not be resolved through the web.config or the executables app.config file.

    null

    0

    ConfigurationException []

    IDictionary

    null

    null

    null

    null

    null

    IDictionary (0 items)

    null

    null

    null

    null

    null

    Data

    IDictionary (0 items)

    InnerException

    null

    TargetSite

    RuntimeMethodInfo

    DBDriver.connect (ConnectionString connectionString, IDictionary driverProps)

    Name

    connect

    DeclaringType

    typeof (DBDriver)

    ReflectedType

    typeof (DBDriver)

    MemberType

    Method

    MetadataToken

    100664396

    Module

    RuntimeModule

    Telerik.OpenAccess.Adonet2.dll

    MDStreamVersion

    131072

    FullyQualifiedName

    C:\Windows\assembly\GAC_MSIL\Telerik.OpenAccess.Adonet2\2011.1.316.10__7ce17eeaf1d59342\Telerik.OpenAccess.Adonet2.dll

    ModuleVersionId

    e432a7a8-1f1e-4e22-9d04-c001112369a3

    MetadataToken

    1

    ScopeName

    Telerik.OpenAccess.Adonet2.dll

    Name

    Telerik.OpenAccess.Adonet2.dll

    Assembly

    RuntimeAssembly

    Telerik.OpenAccess.Adonet2, Version=2011.1.316.10, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342

    CodeBase

    file:///C:/Windows/assembly/GAC_MSIL/Telerik.OpenAccess.Adonet2/2011.1.316.10__7ce17eeaf1d59342/Telerik.OpenAccess.Adonet2.dll

    FullName

    Telerik.OpenAccess.Adonet2, Version=2011.1.316.10, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342

    EntryPoint

    null

    Evidence

    Evidence

    PermissionSet

    PermissionSet

    SecurityRuleSet

    Level1

    ManifestModule

    RuntimeModule

    Telerik.OpenAccess.Adonet2.dll

    ReflectionOnly

    False

    Location

    C:\Windows\assembly\GAC_MSIL\Telerik.OpenAccess.Adonet2\2011.1.316.10__7ce17eeaf1d59342\Telerik.OpenAccess.Adonet2.dll

    ImageRuntimeVersion

    v2.0.50727

    GlobalAssemblyCache

    True

    HostContext

    0

    IsDynamic

    False

    EscapedCodeBase

    file:///C:/Windows/assembly/GAC_MSIL/Telerik.OpenAccess.Adonet2/2011.1.316.10__7ce17eeaf1d59342/Telerik.OpenAccess.Adonet2.dll

    IsFullyTrusted

    True

    ModuleHandle

    ModuleHandle

    System.ModuleHandle

    MDStreamVersion

    131072

    IsSecurityCritical

    True

    IsSecuritySafeCritical

    True

    IsSecurityTransparent

    False

    MethodHandle

    RuntimeMethodHandle

    System.RuntimeMethodHandle

    Value

    IntPtr

    183572012

    Attributes

    PrivateScope, Public, Final, Virtual, HideBySig, VtableLayoutMask

    CallingConvention

    Standard, HasThis

    ReturnType

    typeof (Connection)

    ReturnTypeCustomAttributes

    RuntimeParameterInfo

    Telerik.OpenAccess.RT.sql.Connection

    ParameterType

    typeof (Connection)

    Name

    null

    DefaultValue

    null

    RawDefaultValue

    null

    MetadataToken

    134217728

    Position

    -1

    Attributes

    None

    Member

    RuntimeMethodInfo

    DBDriver.connect (ConnectionString connectionString, IDictionary driverProps)

    IsIn

    False

    IsOut

    False

    IsLcid

    False

    IsRetval

    False

    IsOptional

    False

    ReturnParameter

    RuntimeParameterInfo

    Telerik.OpenAccess.RT.sql.Connection

    ParameterType

    typeof (Connection)

    Name

    null

    DefaultValue

    null

    RawDefaultValue

    null

    MetadataToken

    134217728

    Position

    -1

    Attributes

    None

    Member

    RuntimeMethodInfo

    DBDriver.connect (ConnectionString connectionString, IDictionary driverProps)

    IsIn

    False

    IsOut

    False

    IsLcid

    False

    IsRetval

    False

    IsOptional

    False

    IsGenericMethod

    False

    IsGenericMethodDefinition

    False

    ContainsGenericParameters

    False

    IsPublic

    True

    IsPrivate

    False

    IsFamily

    False

    IsAssembly

    False

    IsFamilyAndAssembly

    False

    IsFamilyOrAssembly

    False

    IsStatic

    False

    IsFinal

    True

    IsVirtual

    True

    IsHideBySig

    True

    IsAbstract

    False

    IsSpecialName

    False

    IsConstructor

    False

    StackTrace

       at Telerik.OpenAccess.RT.Adonet2Generic.Impl.DBDriver.connect(ConnectionString connectionString, IDictionary driverProps)
       at OpenAccessRuntime.Relational.sql.SqlDriver.InitializeFor(String url, Boolean noConnect, PropertySet props, Driver& driver, Connection& conn)
       at OpenAccessRuntime.Relational.RelationalStorageManagerFactory..ctor(StorageManagerFactoryBuilder b)
       at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()

    HelpLink

    null

    Source

    Telerik.OpenAccess.Adonet2

    TargetSite

    RuntimeMethodInfo

    ExceptionWrapper.Throw ()

    Name

    Throw

    DeclaringType

    typeof (ExceptionWrapper)

    ReflectedType

    typeof (ExceptionWrapper)

    MemberType

    Method

    MetadataToken

    100678222

    Module

    RuntimeModule

    Telerik.OpenAccess.Runtime.dll

    MDStreamVersion

    131072

    FullyQualifiedName

    C:\Windows\assembly\GAC_MSIL\Telerik.OpenAccess.Runtime\2011.1.316.10__7ce17eeaf1d59342\Telerik.OpenAccess.Runtime.dll

    ModuleVersionId

    16b86056-6b5d-4a17-a7e9-33003c7b2eda

    MetadataToken

    1

    ScopeName

    Telerik.OpenAccess.Runtime.dll

    Name

    Telerik.OpenAccess.Runtime.dll

    Assembly

    RuntimeAssembly

    Telerik.OpenAccess.Runtime, Version=2011.1.316.10, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342

    CodeBase

    file:///C:/Windows/assembly/GAC_MSIL/Telerik.OpenAccess.Runtime/2011.1.316.10__7ce17eeaf1d59342/Telerik.OpenAccess.Runtime.dll

    FullName

    Telerik.OpenAccess.Runtime, Version=2011.1.316.10, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342

    EntryPoint

    null

    Evidence

    Evidence (5 items)

    PublicKey

    Name

    Version

    Value

    SecurityZone

    SHA1

    SHA256

    MD5

    StrongNamePublicKeyBlob

    002400000480000094000000060200000024000052534131000400000100010007A8EE512FFF7BEA80605757EECE4F358201E958B3C4A166FF906DF807D81BE8FACD3379AF92AAE652AF04...

    Telerik.OpenAccess.Runtime

    Version

    2011.1.316.10

    file:///C:/Windows/assembly/GAC_MSIL/Telerik.OpenAccess.Runtime/2011.1.316.10__7ce17eeaf1d59342/Telerik.OpenAccess.Runtime.dll

    MyComputer

    91 A4 9D 39 C2 4B 88 C2 5F C5 42 07 C2 01 92 AD 38 54 FA B1

    byte[]

    1E 85 82 59 EA 51 EB D2 DF D3 9C EA 86 A2 03 30

    PermissionSet

    PermissionSet (0 items)

    SecurityRuleSet

    Level1

    ManifestModule

    RuntimeModule

    Telerik.OpenAccess.Runtime.dll

    ReflectionOnly

    False

    Location

    C:\Windows\assembly\GAC_MSIL\Telerik.OpenAccess.Runtime\2011.1.316.10__7ce17eeaf1d59342\Telerik.OpenAccess.Runtime.dll

    ImageRuntimeVersion

    v2.0.50727

    GlobalAssemblyCache

    True

    HostContext

    0

    IsDynamic

    False

    EscapedCodeBase

    file:///C:/Windows/assembly/GAC_MSIL/Telerik.OpenAccess.Runtime/2011.1.316.10__7ce17eeaf1d59342/Telerik.OpenAccess.Runtime.dll

    IsFullyTrusted

    True

    ModuleHandle

    ModuleHandle

    System.ModuleHandle

    MDStreamVersion

    131072

    IsSecurityCritical

    True

    IsSecuritySafeCritical

    True

    IsSecurityTransparent

    False

    MethodHandle

    RuntimeMethodHandle

    System.RuntimeMethodHandle

    Value

    IntPtr

    128253492

    Attributes

    PrivateScope, Public, Virtual, HideBySig, VtableLayoutMask

    CallingConvention

    Standard, HasThis

    ReturnType

    typeof (Exception)

    ReturnTypeCustomAttributes

    RuntimeParameterInfo

    System.Exception

    ParameterType

    typeof (Exception)

    Name

    null

    DefaultValue

    null

    RawDefaultValue

    null

    MetadataToken

    134217728

    Position

    -1

    Attributes

    None

    Member

    RuntimeMethodInfo

    ExceptionWrapper.Throw ()

    IsIn

    False

    IsOut

    False

    IsLcid

    False

    IsRetval

    False

    IsOptional

    False

    ReturnParameter

    RuntimeParameterInfo

    System.Exception

    ParameterType

    typeof (Exception)

    Name

    null

    DefaultValue

    null

    RawDefaultValue

    null

    MetadataToken

    134217728

    Position

    -1

    Attributes

    None

    Member

    RuntimeMethodInfo

    ExceptionWrapper.Throw ()

    IsIn

    False

    IsOut

    False

    IsLcid

    False

    IsRetval

    False

    IsOptional

    False

    IsGenericMethod

    False

    IsGenericMethodDefinition

    False

    ContainsGenericParameters

    False

    IsPublic

    True

    IsPrivate

    False

    IsFamily

    False

    IsAssembly

    False

    IsFamilyAndAssembly

    False

    IsFamilyOrAssembly

    False

    IsStatic

    False

    IsFinal

    False

    IsVirtual

    True

    IsHideBySig

    True

    IsAbstract

    False

    IsSpecialName

    False

    IsConstructor

    False

    StackTrace

       at Telerik.OpenAccess.RT.ExceptionWrapper.Throw()
       at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()
       at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createStorageManagerFactory()
       at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.createStorageManagerFactory()
       at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryBase.init()
       at OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.init()
       at OpenAccessRuntime.DataObjects.BootstrapPMF.getPersistenceManagerFactory(PropertySet props)
       at Telerik.OpenAccess.RT.Helper.getPersistenceManagerFactory(PropertySet props)
       at Telerik.OpenAccess.RT.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open)
       at Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope(TransactionProvider provider)
       at Telerik.OpenAccess.Database.GetObjectScope(TransactionProvider provider)
       at Telerik.OpenAccess.OpenAccessContextBase.GetScope()
       at Telerik.OpenAccess.OpenAccessContext.GetAll[T]()
       at ITNavWService.StoreDB.get_Objekats() in C:\Users\Michael\Documents\Visual Studio 2010\Projects\ITNavStoreV4\ITNavWService\Entity\ITStore.cs:line 72

    Source

    Telerik.OpenAccess.Runtime

  3. DevCraft banner
  4. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 03 Jun 2011 Link to this post

    Hi Michael,

    Here is a blog post about using LinqPad with OpenAccess, although it is a bit outdated and refers to the "classic" approach of OpenAccess, not to the visual designer.

    The exception you see means that the connection string with name "Connection" cannot be resolved from the configuration file of the currently executing assembly. In this case this assembly is the executable file of LinqPad, which I guess does not have your connection string in its configuration. To avoid this behavior you can pass the connection string directly to the OpenAccessContext's constructor. This way OpenAccess will not try to resolve it by name from the configuration file. The code would look like this:
    EntitiesModel context = new EntitiesModel("FullConnectionStringHere");
    I hope that helps.

    Kind regards,
    Alexander
    the Telerik team
    Want to use Telerik OpenAccess with SQL Azure? Download the trial version today. 
  5. Michael
    Michael avatar
    29 posts
    Member since:
    Nov 2010

    Posted 03 Jun 2011 Link to this post

    Thanks Alexander,

    I read that blog before I post here for help, anyway your post helped me!

    I have code :

    StoreDB pgData = new StoreDB();
    var c = from p in pgData.Objekats
     select p;
    c.Dump();

     

     

    And with your corrections this is working code :
    StoreDB pgData = new StoreDB("server=localhost;port=5432;database=store;user id=ITerp;password=iterp011");

     

     

    var c = from p in pgData.Objekats
     select p;
    c.Dump();

     

    I have web.config and Connection string in! It's Webservis and is working very well. I just want to try if I can query from linqpad. I setup linqpad with dll's and namespace's but can't read connection string from web.config. Maybe it can't work with webservis dll?

     

     

     

     

     

  6. Answer
    Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 07 Jun 2011 Link to this post

    Hi Michael,

    LinqPad is referencing your service dll as a class library in order to access the StoreDB and persistent classes, this assembly is not actually being executed and the service inside is not running. So the executing assembly, in which OpenAccess is looking for a connection string, is the LinqPad application itself. So if you need to use a connection string from a config file, you need to set it in the configuration file of LinqPad, which most likely is named LinqPad.exe.config. If there is no such file, you can create one.

    Nevertheless, I believe the easier way is to just pass the connection string as parameter, as it seems to be working correctly.

    Greetings,
    Alexander
    the Telerik team
    Want to use Telerik OpenAccess with SQL Azure? Download the trial version today. 
  7. Garry
    Garry avatar
    205 posts
    Member since:
    Nov 2010

    Posted 28 Aug 2011 Link to this post

    Alexander,
    I am also having issue with LinqPad querying a WCF service using OpenAccess. The service seems to be working but no matter how simple of a query I try to run I get this error in LinqPad, The type or namespace name 'DataManager' does not exist in the namespace 'LINQPad.User.Kiopia.BaseEntities'. BaseEntities is my OpenAccess model class.

    Anyone else having this issue or got a work around?

    Thanks,
    Garry 
  8. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 31 Aug 2011 Link to this post

    Hi Garry,

    Could you please give some more details about this missing DataManager - where are you using it and which assembly contains it? Please double-check that you have added a reference in LinqPad to this assembly. It would be helpful if you could send us the code you are trying to execute as well as the list of references you have added, so we can try to reproduce the error locally.

    Greetings,
    Alexander
    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 >>

Back to Top
DevCraft banner