Error while trying to map SQL2012 Filetable

10 posts, 0 answers
  1. Allan Michaelsen
    Allan Michaelsen avatar
    6 posts
    Member since:
    Aug 2009

    Posted 16 Nov 2013 Link to this post

    Hi all

    I'm trying to map a MS SQL 2012 database with a filetable. The mapping goes fine during the Whole process of creating the classes and all, but when I run the program and try to read from the database I get this error:

    An unhandled exception of type 'Telerik.OpenAccess.Exceptions.MetadataException' occurred in Telerik.OpenAccess.Runtime.dll

    Additional information: The metadata for field '_parent_path_locator1' of class 'Filestream.FilestreamTest' cannot be initialized: Type converter initialization failed. The converter with name 'BinaryNullConverter' does not convert from CLR type 'Microsoft.SqlServer.Types.SqlHierarchyId' to SQL type 'hierarchyid'.

    Parameter name: converterName

    Actual value was OpenAccessRuntime.Data.BinaryNullConverter, Telerik.OpenAccess.Runtime, Version=2013.3.1014.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342.

    Anyone has an idea as to why the error occurs?

    /Allan

  2. Ady
    Admin
    Ady avatar
    589 posts

    Posted 21 Nov 2013 Link to this post

    Hello Allan,

     Can you send me the table structure so that I can try and reproduce the error or can you send me the .rlinq file?

    Regards,
    Ady
    Telerik
    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
  3. DevCraft banner
  4. Allan Michaelsen
    Allan Michaelsen avatar
    6 posts
    Member since:
    Aug 2009

    Posted 04 Dec 2013 Link to this post

    How can I attach the file?

    Could you make a sample application using sql 2012, filetable and openaccess?

    <?xml version="1.0" encoding="utf-8"?>
    <DomainModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="2.0.0.0" name="EntitiesModel" namespace="EF_Filestream" showPropertiesCompartment="true" xmlns="http://www.telerik.com/ORM">
      <orm:orm name="EntitiesModel" backend="mssql" default-schema="dbo" xmlns:orm="http://tempuri.org/ORM">
        <orm:namespace name="EF_Filestream" default="true">
          <orm:class name="FilestreamTest_1" uniqueId="770df134-2043-457d-9294-2b33e276383a">
            <orm:table name="FilestreamTest_1" />
            <orm:identity>
              <orm:key-generator name="autoinc">
                <orm:key-generator-member property-name="Path_locator" />
              </orm:key-generator>
              <orm:single-field field-name="_path_locator" />
            </orm:identity>
            <orm:concurrency strategy="changed" />
            <orm:field name="_stream_id" property="Stream_id" behavior="readwrite" uniqueId="8ba36962-85fe-4d8a-955e-12947d7b30b7" type="System.Guid">
              <orm:column name="stream_id" sql-type="uniqueidentifier" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Guid" />
            </orm:field>
            <orm:field name="_file_stream" property="File_stream" behavior="readwrite" uniqueId="ea8749eb-8018-461f-bc45-bacefab40fd3" type="System.Byte[]">
              <orm:column name="file_stream" sql-type="varbinary(max)" nullable="true" length="0" scale="0" ado-type="Filestream" />
            </orm:field>
            <orm:field name="_name" property="Name" behavior="readwrite" uniqueId="4c0201fd-02bf-4726-8eaf-aa6bac366073" type="System.String">
              <orm:column name="name" sql-type="nvarchar" nullable="false" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
            </orm:field>
            <orm:field name="_path_locator" property="Path_locator" behavior="readwrite" uniqueId="991955fe-206a-48f4-b193-a9391ebe37f2" type="Microsoft.SqlServer.Types.SqlHierarchyId, Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91">
              <orm:column name="path_locator" sql-type="hierarchyid" nullable="false" length="0" scale="0" primary-key="true" has-default-value="true" backend-calculated="true" ado-type="LongVarBinary" />
            </orm:field>
            <orm:field name="_parent_path_locator" property="Parent_path_locator" behavior="readwrite" uniqueId="795f9a1a-1435-4736-afec-5f63459fd73d" type="Microsoft.SqlServer.Types.SqlHierarchyId, Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91">
              <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
            </orm:field>
            <orm:field name="_file_type" property="File_type" behavior="readwrite" uniqueId="a23afdc7-f1ae-4904-9b6c-ca0e37791179" type="System.String">
              <orm:column name="file_type" sql-type="nvarchar" nullable="true" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
            </orm:field>
            <orm:field name="_cached_file_size" property="Cached_file_size" behavior="readwrite" uniqueId="18100a91-fd95-4074-b384-a70bab9cc011" type="System.Nullable`1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]">
              <orm:column name="cached_file_size" sql-type="bigint" nullable="true" length="0" scale="0" ado-type="Int64" />
            </orm:field>
            <orm:field name="_creation_time" property="Creation_time" behavior="readwrite" uniqueId="014dbca2-bc58-4ee8-8a0d-f4514344e6a2" type="System.DateTimeOffset">
              <orm:column name="creation_time" sql-type="datetimeoffset" nullable="false" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            </orm:field>
            <orm:field name="_last_write_time" property="Last_write_time" behavior="readwrite" uniqueId="b1a80dac-76ea-4306-bd3c-810735ad8e61" type="System.DateTimeOffset">
              <orm:column name="last_write_time" sql-type="datetimeoffset" nullable="false" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            </orm:field>
            <orm:field name="_last_access_time" property="Last_access_time" behavior="readwrite" uniqueId="c084cc97-2daa-4e4b-b310-0679424b6c8d" type="System.Nullable`1[[System.DateTimeOffset, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]">
              <orm:column name="last_access_time" sql-type="datetimeoffset" nullable="true" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            </orm:field>
            <orm:field name="_is_directory" property="Is_directory" behavior="readwrite" uniqueId="27975142-b248-42d2-b097-7663a9bfa4d0" type="System.Boolean">
              <orm:column name="is_directory" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            </orm:field>
            <orm:field name="_is_offline" property="Is_offline" behavior="readwrite" uniqueId="e14b0a9a-cab4-4f51-b1b8-26886c395da2" type="System.Boolean">
              <orm:column name="is_offline" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            </orm:field>
            <orm:field name="_is_hidden" property="Is_hidden" behavior="readwrite" uniqueId="09f3a175-045a-4ca8-a8f1-6d47984d4a83" type="System.Boolean">
              <orm:column name="is_hidden" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            </orm:field>
            <orm:field name="_is_readonly" property="Is_readonly" behavior="readwrite" uniqueId="216ccd43-2a43-4039-b01e-cd1d4025b3c5" type="System.Boolean">
              <orm:column name="is_readonly" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            </orm:field>
            <orm:field name="_is_archive" property="Is_archive" behavior="readwrite" uniqueId="005be2f3-5404-43ed-affa-4994b6d7d597" type="System.Boolean">
              <orm:column name="is_archive" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            </orm:field>
            <orm:field name="_is_system" property="Is_system" behavior="readwrite" uniqueId="85e932e9-4b6f-4619-9801-43fa3cf5e932" type="System.Boolean">
              <orm:column name="is_system" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            </orm:field>
            <orm:field name="_is_temporary" property="Is_temporary" behavior="readwrite" uniqueId="df38e077-93c6-4875-89c2-381739ae04b8" type="System.Boolean">
              <orm:column name="is_temporary" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            </orm:field>
            <orm:field name="_Parent" property="Parent" behavior="readwrite" uniqueId="c3d729e4-c773-4df3-8f18-efd990bb57b1" type="EF_Filestream.FilestreamTest_1">
              <orm:reference uniqueId="af953ccb-40e4-47f9-848e-f66d6bde2d12" association-name="FilestreamTest_1HasFilestreamTest_1">
                <orm:sharedfield name="_parent_path_locator" target-class="EF_Filestream.FilestreamTest_1" target-field="_path_locator" />
                <orm:constraint name="FK__Filestrea__paren__3C69FB99" delete-action="dbdefaultrule" destination-table="FilestreamTest_1" />
              </orm:reference>
            </orm:field>
            <orm:field name="_Children" property="Children" behavior="readwrite" uniqueId="18ac07bf-7af1-49a6-b9ce-04ce48a38782" type="EF_Filestream.FilestreamTest_1">
              <orm:collection element-class="EF_Filestream.FilestreamTest_1" inverse-field="_Parent" order-by="" uniqueId="af953ccb-40e4-47f9-848e-f66d6bde2d12" />
            </orm:field>
            <orm:index name="UQ__Filestre__A236CBB3021923C5" unique="true">
              <orm:columnMapping>
                <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
              </orm:columnMapping>
              <orm:columnMapping>
                <orm:column name="name" sql-type="nvarchar" nullable="false" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
              </orm:columnMapping>
            </orm:index>
            <orm:index name="UQ__Filestre__9DD95BAFD3B8B066" unique="true">
              <orm:columnMapping>
                <orm:column name="stream_id" sql-type="uniqueidentifier" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Guid" />
              </orm:columnMapping>
            </orm:index>
          </orm:class>
        </orm:namespace>
        <orm:schema schema="">
          <orm:table name="EF_FilestreamTest">
            <orm:column name="stream_id" sql-type="uniqueidentifier" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Guid" />
            <orm:column name="file_stream" sql-type="varbinary(max)" nullable="true" length="0" scale="0" ado-type="Filestream" />
            <orm:column name="name" sql-type="nvarchar" nullable="false" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
            <orm:column name="path_locator" sql-type="hierarchyid" nullable="false" length="0" scale="0" primary-key="true" has-default-value="true" backend-calculated="true" ado-type="LongVarBinary" />
            <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
            <orm:column name="file_type" sql-type="nvarchar" nullable="true" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
            <orm:column name="cached_file_size" sql-type="bigint" nullable="true" length="0" scale="0" ado-type="Int64" />
            <orm:column name="creation_time" sql-type="datetimeoffset" nullable="false" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            <orm:column name="last_write_time" sql-type="datetimeoffset" nullable="false" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            <orm:column name="last_access_time" sql-type="datetimeoffset" nullable="true" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            <orm:column name="is_directory" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_offline" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_hidden" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_readonly" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_archive" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_system" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_temporary" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:index name="UQ__EF_Files__9DD95BAF970E7313" unique="true">
              <orm:columnMapping>
                <orm:column name="stream_id" sql-type="uniqueidentifier" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Guid" />
              </orm:columnMapping>
            </orm:index>
            <orm:index name="UQ__EF_Files__A236CBB32586DBB9" unique="true">
              <orm:columnMapping>
                <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
              </orm:columnMapping>
              <orm:columnMapping>
                <orm:column name="name" sql-type="nvarchar" nullable="false" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
              </orm:columnMapping>
            </orm:index>
            <orm:constraint name="FK__EF_Filest__paren__1DE57479" delete-action="dbdefaultrule" destination-table="EF_FilestreamTest">
              <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
            </orm:constraint>
          </orm:table>
          <orm:table name="FilestreamTest_1">
            <orm:column name="stream_id" sql-type="uniqueidentifier" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Guid" />
            <orm:column name="file_stream" sql-type="varbinary(max)" nullable="true" length="0" scale="0" ado-type="Filestream" />
            <orm:column name="name" sql-type="nvarchar" nullable="false" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
            <orm:column name="path_locator" sql-type="hierarchyid" nullable="false" length="0" scale="0" primary-key="true" has-default-value="true" backend-calculated="true" ado-type="LongVarBinary" />
            <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
            <orm:column name="file_type" sql-type="nvarchar" nullable="true" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
            <orm:column name="cached_file_size" sql-type="bigint" nullable="true" length="0" scale="0" ado-type="Int64" />
            <orm:column name="creation_time" sql-type="datetimeoffset" nullable="false" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            <orm:column name="last_write_time" sql-type="datetimeoffset" nullable="false" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            <orm:column name="last_access_time" sql-type="datetimeoffset" nullable="true" length="7" scale="0" has-default-value="true" ado-type="DateTime" />
            <orm:column name="is_directory" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_offline" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_hidden" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_readonly" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_archive" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_system" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:column name="is_temporary" sql-type="bit" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Bit" />
            <orm:index name="UQ__Filestre__A236CBB3021923C5" unique="true">
              <orm:columnMapping>
                <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
              </orm:columnMapping>
              <orm:columnMapping>
                <orm:column name="name" sql-type="nvarchar" nullable="false" length="255" scale="0" ado-type="UnicodeStringVariableLength" />
              </orm:columnMapping>
            </orm:index>
            <orm:index name="UQ__Filestre__9DD95BAFD3B8B066" unique="true">
              <orm:columnMapping>
                <orm:column name="stream_id" sql-type="uniqueidentifier" nullable="false" length="0" scale="0" has-default-value="true" ado-type="Guid" />
              </orm:columnMapping>
            </orm:index>
            <orm:constraint name="FK__Filestrea__paren__3C69FB99" delete-action="dbdefaultrule" destination-table="FilestreamTest_1">
              <orm:column name="parent_path_locator" sql-type="hierarchyid" nullable="true" length="0" scale="0" ado-type="LongVarBinary" />
            </orm:constraint>
          </orm:table>
        </orm:schema>
        <orm:relational-naming-settings>
          <orm:source-strategy>Property</orm:source-strategy>
          <orm:remove-camel-case>False</orm:remove-camel-case>
        </orm:relational-naming-settings>
      </orm:orm>
      <ModelSettings xmlns="">
        <AppConfigConnectionPropertyName>EF_FilestreamTestConnection</AppConfigConnectionPropertyName>
        <AppConfigConnectionString>data source=.\sqlexpress;initial catalog=EF_FilestreamTest;persist security info=True;user id=sa;password=ThisIsAPW.1234</AppConfigConnectionString>
        <InitialCatalog>EF_FilestreamTest</InitialCatalog>
        <NamingSettings>
          <ClassRules>
            <CaseMode>PascalCase</CaseMode>
            <PluralizationMode>Singularize</PluralizationMode>
          </ClassRules>
          <FieldRules>
            <AddPrefix>_</AddPrefix>
            <CaseMode>CamelCase</CaseMode>
          </FieldRules>
          <PropertyRules>
            <CaseMode>PascalCase</CaseMode>
          </PropertyRules>
          <NavigationPropertyRules />
        </NamingSettings>
        <CodeGenerationSettings>
          <MappingDefinitionType>Xml</MappingDefinitionType>
        </CodeGenerationSettings>
        <SchemaUpdateSettings />
        <BackendConfigurationSettings>
          <BackendConfiguration>
            <Backend>MsSql</Backend>
            <ProviderName>System.Data.SqlClient</ProviderName>
          </BackendConfiguration>
        </BackendConfigurationSettings>
      </ModelSettings>
      <Types>
        <DomainClass Id="770df134-2043-457d-9294-2b33e276383a" name="FilestreamTest_1" namespace="EF_Filestream" showPropertiesCompartment="true" identityMechanism="DatabaseServerCalculated" concurrencyMode="Changed" showNavigationCompartment="true" showImplementationCompartment="true" identityMechanismMember="Path_locator">
          <Property Id="991955fe-206a-48f4-b193-a9391ebe37f2" name="Path_locator" type="SqlHierarchyId" label="Path_locator : SqlHierarchyId" kind="Persistent" identity="true" fieldName="_path_locator" />
          <Property Id="18100a91-fd95-4074-b384-a70bab9cc011" name="Cached_file_size" type="Int64" label="Cached_file_size : Int64" nullable="true" kind="Persistent" fieldName="_cached_file_size" />
          <Property Id="014dbca2-bc58-4ee8-8a0d-f4514344e6a2" name="Creation_time" type="DateTimeOffset" label="Creation_time : DateTimeOffset" kind="Persistent" fieldName="_creation_time" />
          <Property Id="ea8749eb-8018-461f-bc45-bacefab40fd3" name="File_stream" type="Byte[]" label="File_stream : Byte[]" kind="Persistent" fieldName="_file_stream" />
          <Property Id="a23afdc7-f1ae-4904-9b6c-ca0e37791179" name="File_type" label="File_type : String" kind="Persistent" fieldName="_file_type" />
          <Property Id="005be2f3-5404-43ed-affa-4994b6d7d597" name="Is_archive" type="Boolean" label="Is_archive : Boolean" kind="Persistent" fieldName="_is_archive" />
          <Property Id="27975142-b248-42d2-b097-7663a9bfa4d0" name="Is_directory" type="Boolean" label="Is_directory : Boolean" kind="Persistent" fieldName="_is_directory" />
          <Property Id="09f3a175-045a-4ca8-a8f1-6d47984d4a83" name="Is_hidden" type="Boolean" label="Is_hidden : Boolean" kind="Persistent" fieldName="_is_hidden" />
          <Property Id="e14b0a9a-cab4-4f51-b1b8-26886c395da2" name="Is_offline" type="Boolean" label="Is_offline : Boolean" kind="Persistent" fieldName="_is_offline" />
          <Property Id="216ccd43-2a43-4039-b01e-cd1d4025b3c5" name="Is_readonly" type="Boolean" label="Is_readonly : Boolean" kind="Persistent" fieldName="_is_readonly" />
          <Property Id="85e932e9-4b6f-4619-9801-43fa3cf5e932" name="Is_system" type="Boolean" label="Is_system : Boolean" kind="Persistent" fieldName="_is_system" />
          <Property Id="df38e077-93c6-4875-89c2-381739ae04b8" name="Is_temporary" type="Boolean" label="Is_temporary : Boolean" kind="Persistent" fieldName="_is_temporary" />
          <Property Id="c084cc97-2daa-4e4b-b310-0679424b6c8d" name="Last_access_time" type="DateTimeOffset" label="Last_access_time : DateTimeOffset" nullable="true" kind="Persistent" fieldName="_last_access_time" />
          <Property Id="b1a80dac-76ea-4306-bd3c-810735ad8e61" name="Last_write_time" type="DateTimeOffset" label="Last_write_time : DateTimeOffset" kind="Persistent" fieldName="_last_write_time" />
          <Property Id="4c0201fd-02bf-4726-8eaf-aa6bac366073" name="Name" label="Name : String" kind="Persistent" fieldName="_name" />
          <Property Id="795f9a1a-1435-4736-afec-5f63459fd73d" name="Parent_path_locator" type="SqlHierarchyId" label="Parent_path_locator : SqlHierarchyId" kind="Persistent" fieldName="_parent_path_locator" />
          <Property Id="8ba36962-85fe-4d8a-955e-12947d7b30b7" name="Stream_id" type="Guid" label="Stream_id : Guid" kind="Persistent" fieldName="_stream_id" />
          <AssociationTargets>
            <Association Id="af953ccb-40e4-47f9-848e-f66d6bde2d12" SourceMultiplicity="ZeroOne" name="FilestreamTest_1HasFilestreamTest_1">
              <DomainClassMoniker name="/EntitiesModel/FilestreamTest_1" />
              <targetNavigationalProperty>
                <associationDefinesTargetProperty Id="933c54e5-9b8d-4b0a-b098-4e5e896840b6">
                  <NavigationalPropertyMoniker name="/EntitiesModel/FilestreamTest_1/Children" />
                </associationDefinesTargetProperty>
              </targetNavigationalProperty>
              <sourceNavigationalProperty>
                <associationDefinesSourceProperty Id="82c66866-9ac1-4fc8-84da-7d71aee27d9d">
                  <NavigationalPropertyMoniker name="/EntitiesModel/FilestreamTest_1/Parent" />
                </associationDefinesSourceProperty>
              </sourceNavigationalProperty>
            </Association>
          </AssociationTargets>
          <navigationalProperties>
            <classHasNavigationalProperties Id="f8a19535-ebf2-457d-840e-755a26abd7ff">
              <NavigationalProperty Id="c3d729e4-c773-4df3-8f18-efd990bb57b1" name="Parent" type="FilestreamTest_1" label="Parent : FilestreamTest_1" nullable="true" kind="Persistent" fieldName="_Parent" isDependent="false" isManaged="false" />
            </classHasNavigationalProperties>
            <classHasNavigationalProperties Id="00178b91-8ea6-46f0-bec6-7dc1043094e8">
              <NavigationalProperty Id="18ac07bf-7af1-49a6-b9ce-04ce48a38782" name="Children" type="IList<FilestreamTest_1>" label="Children : IList<FilestreamTest_1>" nullable="true" kind="Persistent" fieldName="_Children" isDependent="false" isManaged="false" />
            </classHasNavigationalProperties>
          </navigationalProperties>
        </DomainClass>
      </Types>
      <domainContext>
        <domainModelHasDomainContext Id="fa07be37-290b-42d8-ae70-343a8481d7e9">
          <domainContainer name="EntitiesModel" namespace="EF_Filestream" showPropertiesCompartment="true">
            <entitySetProperty name="FilestreamTest_1" namespace="EF_Filestream" type="FilestreamTest_1" label="FilestreamTest_1 : IQueryable<EF_Filestream.FilestreamTest_1>" />
          </domainContainer>
        </domainModelHasDomainContext>
      </domainContext>
    </DomainModel>

  5. Pobert
    Pobert avatar
    1 posts
    Member since:
    Oct 2013

    Posted 06 Dec 2013 Link to this post

    Hello

    I have got this error too.
    I think it occured because of each record in "FileTable" table in SQL Sever has a relation 1-to-many to itself. So, OpenAccess mapped it succesfully, but not correctly handle. Thats why i just delete this relation in OA diagram.

    It is not a solution, just my opinion. I hope Telerik`s team will solve this problem soon.
  6. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 06 Dec 2013 Link to this post

    Hi,

    Thank you for the provided .rlinq file.

    The error you are getting is due to a problem in the type converter responsible for the hierarchyid SQL type. This is a known issue which will be fixed in the future. We apologize for the caused inconvenience.

    Meanwhile you can circumvent this behavior using the following steps:
    1. Using Model Schema Explorer, navigate to each hierarchyid column of your file table.
    2. Open the properties window using F4.
    3. The property AdoType will be set to -4, remove its value.
    4. Do this for every column of your file table with type hierarchyid and save the model.

    I have attached a sample project illustrating a FileTable mapped in a Domain Model and how to perform CRUD operations against it. Note that in order to run it you will have to upgrade the OpenAccess references and create the database with a FileTable inside.

    I hope this helps.

    Regards,
    Kristian Nikolov
    Telerik
    OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
  7. Kurt
    Kurt avatar
    3 posts
    Member since:
    Jan 2014

    Posted 06 Feb 2014 Link to this post

    I am having the same problem,I have the latest version of Data Access(I believe), when I go to the hierarchyid column and navigate to the properties menu I cannot find a property called AdoType. Am I just looking in the wrong place or is my version of data access different?
  8. Allan Michaelsen
    Allan Michaelsen avatar
    6 posts
    Member since:
    Aug 2009

    Posted 08 Feb 2014 Link to this post

    After testing a bit with the solution you set up and upgrading to latest version of DataAccess, not even the workaround you suggested work. Even when I change the ADO Type, the error regarding the converter persists.
    Have you changed something in DataAccess to try and fix the issue and thereby negating the workaround at the same time? Anyway, I consider the description on the webpage for DataAccess to be false advertising since you say it works with filetables when in fact it doesn't. Even the new version with namechange and everything has done nothing to change that fact.

    You said it would be fixed in the future, but when is that future? I figured it would be in the nextrelease or the one thereafter, but appearently not.
  9. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 11 Feb 2014 Link to this post

    Hello,

    The workaround previously described and illustrated in the sample project is still applicable in Q3 2013 SP2 release of Telerik Data Access.

    @ Kurt - the ADO Type property is available in the properties window for table columns in Model Schema Explorer. To reach the table columns, in the Model Schema Explorer expand the Tables node and then the node of the required table. Please verify whether you are opening the properties window for a table column.

    @ Allan - we ran the previously provided sample project with the latest version of Telerik Data Access (2013.3.1320). The application successfully performed CRUD operations against the file table. We also implemented the workaround in a new solution, done entirely in the latest Data Access version and achieved the same result. Please make sure that all table columns with Sql Type hierarcyid in Model Schema Explorer have their Ado Type property value cleared.

    If the issue continues to persist, could you tell us if there are any modifications made in the sample project, what are they and what were the steps you took leading to the recurrence of the issue?

    As for the eventual fix of the problem, unfortunately we cannot provide you with a date for it. The bug has been logged but not yet prioritized and scheduled.

    I hope this helps. Should you have any more questions, feel free to post in our forums again.

    Regards,
    Kristian Nikolov
    Telerik
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
  10. ROBERT
    ROBERT avatar
    3 posts
    Member since:
    Dec 2012

    Posted 26 Feb 2014 in reply to Kristian Nikolov Link to this post

    Kristian,  I've been working with your sample solution against two different SQL Server 2012 databases with filetables.  It appears that deleting the self-relationship is sufficient to resolve the MedatadataException.  However, I am getting the following exception any time I query the filetable (see below).  In the sample solution, the error is generated either during the initial context.[filetables].ToList(), or if the filetable is empty, during the FirstOrDefault in AddEntity.  I have tried removing the ado-type as suggested, but the cast exceptions continue.  I'm using OpenAccess 2013.3.1320.1. 

    Telerik.OpenAccess.OpenAccessException was unhandled
      HResult=-2146233088
      Message=Specified cast is not valid.
      Source=Telerik.OpenAccess
      CanRetry=false
      StackTrace:
           at Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e)
           at OpenAccessRuntime.ExceptionWrapper.Throw()
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.handleException(Exception x, Boolean needsRollback)
           at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.getObjectById(Object oid, Boolean validate)
           at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.getObjectById(Object o, Boolean b)
           at OpenAccessRuntime.DataObjects.QueryResultBase.resolveRow(Object row, OpenAccessPMProxy pm)
           at OpenAccessRuntime.common.QueryResultContainer.toResolvedObject(OpenAccessPMProxy pm)
           at OpenAccessRuntime.DataObjects.ForwardQueryResult.Resolve()
           at OpenAccessRuntime.DataObjects.ForwardQueryResult.Initialize()
           at OpenAccessRuntime.DataObjects.ForwardQueryResult.get_Item(Int32 indexParam)
           at OpenAccessRuntime.ListEnumerator.setCurrent(Int32 _pos)
           at OpenAccessRuntime.ListEnumerator.Move(Int32 relative)
           at OpenAccessRuntime.ListEnumerator.MoveNext()
           at Telerik.OpenAccess.Query.TypedEnumerator`1.MoveNext()
           at Telerik.OpenAccess.Query.ExpressionExecution.PerformDatabaseQuerySingle[TResult,T](ChainedContext context, Expression expression, QueryableCategory before, Int32& found, Int32 elemAt, Boolean single, Boolean diffType)
           at Telerik.OpenAccess.Query.ExpressionExecution.PerformQuerySingle[T,TResult](ExpressionCutter cutter, MethodCallExpression mce, ChainedContext piece, QueryOptions options)
           at Telerik.OpenAccess.Query.Piece`1.ExecuteSingle[TResult](Expression expression)
           at Telerik.OpenAccess.Query.Piece`1.System.Linq.IQueryProvider.Execute[TResult](Expression expr)
           at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)
           at DocumentGet.OpenAccessContextExtensions.AddEntity(EntitiesModel context, String filename, Boolean isReadonly) in c:\Users\jallen\Documents\Visual Studio 2012\Projects\Vegas\DocumentGet\DocumentGet\Program.cs:line 52
           at DocumentGet.Program.Main(String[] args) in c:\Users\jallen\Documents\Visual Studio 2012\Projects\Vegas\DocumentGet\DocumentGet\Program.cs:line 20
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: System.InvalidCastException
           HResult=-2147467262
           Message=Specified cast is not valid.
           Source=DocumentGet
           StackTrace:
                at DocumentGet.Document.OpenAccessEnhancedReplaceField(Int32 fieldNumber)
                at DocumentGet.Document.OpenAccessEnhancedReplaceFields(Int32[] fieldNumbers)
                at OpenAccessRuntime.DataObjects.PCStateMan.InitFromState(OID noid, State aState, OpenAccessPersistenceManagerImp rpm)
                at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.reManage(OID oid, State state)
                at OpenAccessRuntime.DataObjects.LocalPMCache.getByOID(OID oid, Boolean manage)
                at OpenAccessRuntime.DataObjects.OpenAccessPersistenceManagerImp.getObjectById(Object oid, Boolean validate)
           InnerException:

  11. Kristian Nikolov
    Admin
    Kristian Nikolov avatar
    206 posts

    Posted 28 Feb 2014 Link to this post

    Hi Robert,

    The exception you are experiencing could be because your project is referencing version 11 of the Microsoft.SqlServer.Types assembly which contains the SqlHierarchyId CLR type. At the moment Telerik Data Access supports version 10 of the assembly in question.

    To resolve the issue please make sure your project is referencing version 10 of the Microsoft.SqlServer.Types assembly.

    I hope this helps. If you have additional questions, do not hesitate to get back to us via our Ticket System or post in our forums.

    Regards,
    Kristian Nikolov
    Telerik
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top
DevCraft banner