none
Setting Source property of a Class added on the O/R Designer RRS feed

  • Question

  • Hello,

    I would like to know what are the options to set the "Source" property for a class added on the "O/R Designer".
    Is it possible to use something else that a table or a view from an Sql database?
    For example, would it be possible to feed xml data as the source?
    If this is possible, how will the fields be defined?

    Generally any need could be solved by an appropriate table or view.
    However, it could be sometimes convenient to avoid the creation of such additional tables or view to the database.

    Thanks,

    Michel

    Tuesday, June 1, 2010 11:59 AM

Answers

All replies

  • Hi Michel,

     

    Unfortunately, we cannot put other data source in the LINQ to SQL O/R designer.   It only supports SQL Server databases.  

     

    If you want to use XML as the data source, how about using LINQ to XML?   We can use similar LINQ query as we do in LINQ to SQL.   Additional references about LINQ to XML: http://msdn.microsoft.com/en-us/library/bb387098.aspx.  

     

    Besides, for another great ORM, I would recommend ADO.NET Entity Framework, which is more powerful than LINQ to SQL.   We can use many different databases in EF, http://msdn.microsoft.com/en-us/data/dd363565.aspx.   

     

    Hope it is helpful to you!   

     

    Have a nice day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Wednesday, June 2, 2010 2:54 AM
    Moderator
  • Hi Michel,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 

     

    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

     

    Have a nice weekend!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, June 4, 2010 1:16 AM
    Moderator
  • Thanks, Lingzhi, for your answers.
    My aim is to figure out how I will work in the coming months.
    More specially, shall I mimick the way I worked till now in VB6 (and also in java),
    or shall I rely more or less on these wonderful tools like LINQ?

    No doubt I will opt for LINQ since it is incredibely more powerful.

    One more naïve question: why is it that one can "add a class" on the "O/R designer" pane?
    Is the end-purpose not simply to connect this class to an sql-based datasource?
    In the end this amounts to drag-and-droping this datasource to the pane?
    Or are there more possibilities that "simply" representing an sql datasource on the designer pane?

    Thanks again,

    Michel

     

    Sunday, June 6, 2010 7:49 PM
  • Hi Michel,

     

    J   Oh, good question.   I once asked these questions to myself.   I think we can create new class in the O/R designer because if there is certain data table inside the table, we can manually create such a class to map the table instead of dragging the table from Server Explorer to the designer.  

     

    Good day!

     

     

    Best Regards,
    Lingzhi Sun

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, June 8, 2010 8:00 AM
    Moderator
  • One of the reasons you can add a class is because you can map multiple classes to the same table through things like inheritance.

    The other is that you may not yet have a database and may want to use the LINQ to SQL designer to design it and use the DataContext object's CreateDatabase method to issues the database commands to create it.

    [)amien

    Tuesday, June 8, 2010 2:49 PM
    Moderator