locked
mex.exe EDMX target MSL broken? RRS feed

  • Question

  • Hi,

    I am trying to generate an EDMX off an M image using mex.exe However the MSL for the EDMX that is generated seems broken.

    For example the expected MSL is
    <edmx:Mappings>
    
          <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
    
            <EntityContainerMapping StorageEntityContainer="GSLMModelStoreContainer" CdmEntityContainer="GSLMEntities">
    
              <EntitySetMapping Name="Addresses"><EntityTypeMapping TypeName="GSLMModel.Address"><MappingFragment StoreEntitySet="Addresses">
    
                <ScalarProperty Name="address_id" ColumnName="address_id" />
    
    


    what I get from mx.exe looks like
    <Mappings>
    
          <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
    
            <EntityContainerMapping StorageEntityContainer="GSLMStoreContainer" CdmEntityContainer="GSLMContainer">
    
               <EntitySetMapping Name="Addresses" StoreEntitySet="Addresses" TypeName="GSLM.Address">
    
                   <ScalarProperty Name="address_id" ColumnName="address_id" />
    
              
    
    
    The EntityTypeMapping and MappingFragment are missing in the generated EDMX relsulting in errors like
    Error	62	Error 10026: The attribute 'StoreEntitySet' on element 'EntitySetMapping' is not supported by the EDM Designer.	C:\Users\NR\Desktop\wmt.edmx	6633	11	Miscellaneous Files
    
    Error	63	Error 10026: The attribute 'TypeName' on element 'EntitySetMapping' is not supported by the EDM Designer.	C:\Users\NR\Desktop\wmt.edmx	6633	11	Miscellaneous Files
    
    
    
    

    Help? Many thanks.

    Also, is there a way to turn off the $MRuntime schema generation where target type is Tsql10 or in Intellipad SQL view? I thought (from early discussions on the advisory forums) that there would be a 'repository' schema and  a standard TSQL10 schema.

    AND ... ideally there should be 'Dynamic Data Website' support directly off the M model instead of going through ADO.NET.

    Regards,
    Nikhil
    Nikhil Rajwade, Technical Architect
    • Edited by Nikhil Rajwade Tuesday, January 12, 2010 9:17 PM strong tags didnt work
    Tuesday, January 12, 2010 9:15 PM

Answers


  • Nikhil.

    You are right, this is a problem with our EDMX generation. If it isn't very large, can you include the M source for your models? I can if it can be rewritten to eliminate the errors you are seeing. I assume that eliminates the need to remove $MRuntime using your script above.

    The M-EF integration we shipped with the Nov 09 CTP is a proof of concept. We'll be addressing these issues as we continue to integrate M and EDM deeply going forward.

    Vaidy

    Friday, January 15, 2010 1:05 AM

All replies

  • Hi Nikhil,

    The EDMX generated is really not "fully" broken, but it just does not generate the elements necessary to support EDM Designer, thus you cannot view the EDMX in the EDM Designer like standard EDMX files.

    As for the $MRuntime, there is no way to turn it off.  It is to support something as part of the SQL generation that is inevitable.

    Going forward we will definitely fix these issues, but for the bits you're working on, I do not know of any work-arounds.

    Thanks.
    Nghi
    Thursday, January 14, 2010 8:23 PM
  • Thanks for the reply Nghi! BUT...

    The EntitySetMapping generated by mex.exe does not validate against the ado schema.
    I am going to stick with "broken". :)

    I understand what the $MRuntime is for... I just want an option to 'separate' MY model from it. Currently I deploy the image, run the script attached below and then use the VS2010 ADO.Net Entity framework to generate the EDMX for MY model. Thats what I want to do as part of 'speeding up DB development'.

    To remove the $MRuntime and other stuff from a deployed image run :
    select 'ALTER TABLE [' + SCHEMA_NAME(schema_id)+'].'+ OBJECT_NAME(parent_object_id) + ' DROP CONSTRAINT [' + name + ']' from sys.foreign_keys 
    where (schema_id = SCHEMA_ID('Language.Catalog') 
    OR schema_id = SCHEMA_ID('Language.Catalog.Clr')
    OR schema_id = SCHEMA_ID('Language.Catalog.Runtime')
    OR schema_id = SCHEMA_ID('Language.Catalog.SQL')
    OR schema_id = SCHEMA_ID('$MRuntime.GSLM')
    OR schema_id = SCHEMA_ID('$MRuntime')
    OR schema_id = SCHEMA_ID('System.ComponentModel.DataAnnotations')
    OR schema_id = SCHEMA_ID('System.ComponentModel')
    OR schema_id = SCHEMA_ID('Language.Edm'))
    
    select 'ALTER TABLE [' + SCHEMA_NAME(schema_id)+'].'+ OBJECT_NAME(parent_object_id) + ' DROP CONSTRAINT [' + name + ']' from sys.check_constraints 
    where (schema_id = SCHEMA_ID('Language.Catalog') 
    OR schema_id = SCHEMA_ID('Language.Catalog.Clr')
    OR schema_id = SCHEMA_ID('Language.Catalog.Runtime')
    OR schema_id = SCHEMA_ID('Language.Catalog.SQL')
    OR schema_id = SCHEMA_ID('$MRuntime.GSLM')
    OR schema_id = SCHEMA_ID('$MRuntime')
    OR schema_id = SCHEMA_ID('System.ComponentModel.DataAnnotations')
    OR schema_id = SCHEMA_ID('System.ComponentModel')
    OR schema_id = SCHEMA_ID('Language.Edm'))
    
    select 'DROP FUNCTION ['+ SCHEMA_NAME(schema_id) + '].' + '[' + name + ']' from sys.objects
    where (schema_id = SCHEMA_ID('Language.Catalog') 
    OR schema_id = SCHEMA_ID('Language.Catalog.Clr')
    OR schema_id = SCHEMA_ID('Language.Catalog.Runtime')
    OR schema_id = SCHEMA_ID('Language.Catalog.SQL')
    OR schema_id = SCHEMA_ID('$MRuntime.GSLM')
    OR schema_id = SCHEMA_ID('$MRuntime')
    OR schema_id = SCHEMA_ID('System.ComponentModel.DataAnnotations')
    OR schema_id = SCHEMA_ID('System.ComponentModel')
    OR schema_id = SCHEMA_ID('Language.Edm'))
    AND type_desc like '%FUNCTION%'
    
    select 'DROP VIEW [' + SCHEMA_NAME(schema_id) + '].' + '[' + name + ']' from sys.views
    where (schema_id = SCHEMA_ID('Language.Catalog') 
    OR schema_id = SCHEMA_ID('Language.Catalog.Clr')
    OR schema_id = SCHEMA_ID('Language.Catalog.Runtime')
    OR schema_id = SCHEMA_ID('Language.Catalog.SQL')
    OR schema_id = SCHEMA_ID('$MRuntime.GSLM')
    OR schema_id = SCHEMA_ID('$MRuntime')
    OR schema_id = SCHEMA_ID('System.ComponentModel.DataAnnotations')
    OR schema_id = SCHEMA_ID('System.ComponentModel')
    OR schema_id = SCHEMA_ID('Language.Edm'))
    
    select 'DROP TABLE [' + SCHEMA_NAME(schema_id) + '].' + '[' + name + ']' from sys.tables
    where (schema_id = SCHEMA_ID('Language.Catalog') 
    OR schema_id = SCHEMA_ID('Language.Catalog.Clr')
    OR schema_id = SCHEMA_ID('Language.Catalog.Runtime')
    OR schema_id = SCHEMA_ID('Language.Catalog.SQL')
    OR schema_id = SCHEMA_ID('$MRuntime.GSLM')
    OR schema_id = SCHEMA_ID('$MRuntime')
    OR schema_id = SCHEMA_ID('System.ComponentModel.DataAnnotations')
    OR schema_id = SCHEMA_ID('System.ComponentModel')
    OR schema_id = SCHEMA_ID('Language.Edm'))
    
    hope others find it as useful in 'speeding up DB development' as I did.

    I like M and the promise of SQL Modelling services, but the tooling needs a lot of work. While my clients are far away from realising the potential of Data Driven Development, adoption of the technology is based on the promise that 'as is' development can be supported while making people thinking about using the full set of features. The prime use of M for my clients at this time is to master the metadata for Logical/Physical ERD's. 

    my $0.02...
    Nick

    Nikhil Rajwade, Technical Architect
    Thursday, January 14, 2010 9:46 PM

  • Nikhil.

    You are right, this is a problem with our EDMX generation. If it isn't very large, can you include the M source for your models? I can if it can be rewritten to eliminate the errors you are seeing. I assume that eliminates the need to remove $MRuntime using your script above.

    The M-EF integration we shipped with the Nov 09 CTP is a proof of concept. We'll be addressing these issues as we continue to integrate M and EDM deeply going forward.

    Vaidy

    Friday, January 15, 2010 1:05 AM
  • Vaidy,

    I can send you the M source as we have a NDA with MS - however do treat it as confidential. If you email me at rajwade@hotmail.com, I will send the M in reply. Many thanks.

    Regards,
    Nick

    Nikhil Rajwade, Technical Architect
    Friday, January 15, 2010 1:29 AM
  • Nikhil--thanks for working with Vaidy on this. Since you're working on confidential matters now, it seems like we can close this thread. Accordingly, I've marked Vaidy's last reply as an answer. If you or Vaidy want to post more on this thread (a generalized workaround, for instance), then feel free to unmark the answer.

    Thanks

    .Kraig
    Friday, January 15, 2010 5:09 AM
  • Hi Vaidy,

     I've run into the same problem. Could you please describe the steps you'll need to do (manually) to get it to work with the designer?

     TIA,

     --larsw
    Lars Wilhelmsen | Development Lead | KrediNor, Norway | Connected Systems MVP | http://larswilhelmsen.com/
    Sunday, March 7, 2010 6:55 PM
  • Hi guys,

     I've put together a tool that fixes the EDMX output by mex.exe - so that it can be opened by the Visual Studio Designer:
      http://larsw.codeplex.com/releases/view/41652


     HTH,

     --larsw

    Lars Wilhelmsen | Development Lead | KrediNor , Norway | Connected Systems MVP | http://larswilhelmsen.com/
    • Proposed as answer by _larsw Sunday, March 7, 2010 9:02 PM
    • Edited by _larsw Tuesday, March 9, 2010 9:22 AM Updated url to download
    Sunday, March 7, 2010 8:59 PM