SofiaCarRental Context Data Model

Thread is closed for posting
13 posts, 0 answers
  1. 63F75A2C-1F16-4AED-AFE8-B1BBD57646AD
    63F75A2C-1F16-4AED-AFE8-B1BBD57646AD avatar
    1572 posts
    Member since:
    Oct 2004

    Posted 26 Apr 2010 Link to this post

    Requirements

    OpenAccess ORM version

    2010.1.414.3

    .NET version

    3.5

    Visual Studio version

    2008

    programming language

    C#


    PROJECT DESCRIPTION
    This is the Data model used in the GettingStarted section in the OpenAccess documentation using the new Domain Model template and context approach.
  2. C936234E-3CF6-4F05-BED1-8DAAA052B198
    C936234E-3CF6-4F05-BED1-8DAAA052B198 avatar
    5 posts
    Member since:
    Jul 2015

    Posted 21 Jul 2015 Link to this post

    Hi,admin,

    Can you update this file?This file was error run in visual studio 2013.

    Thank you!

  3. 54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B
    54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B avatar
    498 posts
    Member since:
    Jan 2017

    Posted 23 Jul 2015 Link to this post

    Hi Ricky,

    Attached you can find the updated version of the Sofia Car Rental model. It uses the Fluent API instead of an .rlinq file, because as of Data Access Q2 2015 the Visual Studio integration is deprecated and the product is distribute only through NuGet packages. You can find more information about the subject here.

    Currently, the latest version of the SofiaCarRental sample database is SofiaCarRental_v2.2 and you can find the SQL about it here. Additionally, the code of the model is available here.

    I hope this helps.


    Regards,
    Doroteya
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  4. C936234E-3CF6-4F05-BED1-8DAAA052B198
    C936234E-3CF6-4F05-BED1-8DAAA052B198 avatar
    5 posts
    Member since:
    Jul 2015

    Posted 23 Jul 2015 Link to this post

    Thank you so much!
  5. 967929D9-B818-4E5D-A69B-6BFF0B9547D4
    967929D9-B818-4E5D-A69B-6BFF0B9547D4 avatar
    10 posts
    Member since:
    Dec 2014

    Posted 28 Dec 2015 Link to this post

    On Visual Studio 2015, I can't compile the WinForm application because of ToList() which is not implemented and wrong context :

     http://docs.telerik.com/data-access/quick-start-scenarios/winforms/quickstart-winforms-retrieving-cars-from-database
    - SofiaCarRentalContext don't seems to be defined for context.I've used FluentModel.
    - this.context.Cars.ToList()and this.context.Cars.Where(car => car.Make == carMakerFilter).ToList() don't compile

    Is there a fully updated version with library & WinForm app ?

    Thanks.

    Vincent

  6. 16B338D7-D4CF-4F03-BF75-FBF13EE08A0B
    16B338D7-D4CF-4F03-BF75-FBF13EE08A0B avatar
    589 posts
    Member since:
    Dec 2016

    Posted 29 Dec 2015 Link to this post

    Hello Vincent,

     What compile time error do you get? Can you please provide that?
    Have you included the 'System.Linq' namespace in the source code? This will include the definition of the linq extension methods.

    Regards,
    Ady
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  7. 967929D9-B818-4E5D-A69B-6BFF0B9547D4
    967929D9-B818-4E5D-A69B-6BFF0B9547D4 avatar
    10 posts
    Member since:
    Dec 2014

    Posted 01 Jan 2016 in reply to 16B338D7-D4CF-4F03-BF75-FBF13EE08A0B Link to this post

    Hi,

    in MainForm_Load(), the code ' this.context = new SofiaCarRentalContext();' don't compile because 'SofiaCarRentalContext' is unknown (missing using or assembly).

  8. 54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B
    54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B avatar
    498 posts
    Member since:
    Jan 2017

    Posted 04 Jan 2016 Link to this post

    Hello Vincent,

    Based on the assumption that you are using the class library attached to this thread, my best guess about the cause for the build error on your side is that the code file of the main form does not hold a reference to the SofiaCarRental namespace (the default namespace of the class library attached to this message is SofiaCarRental). In this situation, you need to add the following code at the beginning of the .cs file:
    using SofiaCarRental;

    Another reason would be that the WinForms project in which the main form resides does not have a reference to the SofiaCarRental assembly. In this case you need to add the reference through the Add Reference dialogue of Visual Studio. Once you do this you need to add the reference to the SofiaCarRental namespace as well.

    I hope this helps.


    Regards,
    Doroteya
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  9. 967929D9-B818-4E5D-A69B-6BFF0B9547D4
    967929D9-B818-4E5D-A69B-6BFF0B9547D4 avatar
    10 posts
    Member since:
    Dec 2014

    Posted 05 Jan 2016 in reply to 54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B Link to this post

    Hi,

     I've opened a ticket with the support who gave me the full project. So now, I'm able to run it but an exception is thrown when accessing the DB :

    "Une exception non gérée du type 'Telerik.OpenAccess.Exceptions.DataStoreException' s'est produite dans Telerik.OpenAccess.Runtime.dll
    Informations supplémentaires : Unable to reach database server on host ''.

    On call on function :

    public IQueryable<Car> Cars
            {
                get
                {
                    return this.GetAll<Car>();
                }
            }

    I have changed the connection string : connectionString="data source=localhost\SQLSERVER2014;initial catalog=SofiaCarRental_v2.2;integrated security=True" providerName="System.Data.SqlClient"

    without any change.

    I ran MS SQL Server 2014 Management Studio 12.0.4213.0. I see the database 'SofiaCarRental_v2.2' and can access tables.

  10. 54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B
    54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B avatar
    498 posts
    Member since:
    Jan 2017

    Posted 07 Jan 2016 Link to this post

    Hi Vincent,

    You can kindly find the details about the issue you are experiencing in the #997851 thread.

    I hope this helps.

    Regards,
    Doroteya
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  11. 967929D9-B818-4E5D-A69B-6BFF0B9547D4
    967929D9-B818-4E5D-A69B-6BFF0B9547D4 avatar
    10 posts
    Member since:
    Dec 2014

    Posted 08 Jan 2016 in reply to 54E5C1F7-01EA-4C5A-BFDF-BFE9D20BE12B Link to this post

    Hi,

    with your help my knowledge is better now. This week, I would like to try something more. Because I'm working on 2 computers, I use One Drive for Business for syncing. So I can take my laptop without Internet connection and continue to work.

    So, in my idea, the main goal is to have the database on Visual Studio solution (so it will be synced back to the desktop computer when I returns). I'm not sure, in Visual Studio 2015, in the Server Explorer windows, I see sometimes a MDF file or a DBO.

    Because I'm making tests, I will add fields to tables often. With the SofiaRental sample, we have a SQL file to generate the database. Then, in my case, what is the building steps of database from scratch and how to update C# mapping to new fields ?

    Thanks,

    Vincent

  12. 56D2ACB1-641E-4F5B-8DB7-07F3B119E643
    56D2ACB1-641E-4F5B-8DB7-07F3B119E643 avatar
    2 posts
    Member since:
    Apr 2016

    Posted 03 Apr 2016 in reply to 967929D9-B818-4E5D-A69B-6BFF0B9547D4 Link to this post

    I've the same problem. My environment is: W8.1x64 + VS2015 update 2 + Telerik Data Access Q3 2015 15.3.926.0 + DataAccess.Core 15.3.1221.1 (from NuGet) & DataAccess.Fluent 15.3.1221.1 (from NuGet).

    I've created "SofiaCarRental.Model" according to manual. It compiles without errors.
    Next, I've created SofiaCarRental.Forms. And there is an error in MainForm_Load() code at:

    Private _context As SofiaCarRentalContext

    ...with message "SofiaCarRentalContext is not defined".

    I've searched for string "SofiaCarRentalContext" over all tutorial's code (C# and VB code).
    And have no results. There is no "SofiaCarRentalContext" definition in the code.

    Adding code:

    Imports SofiaCarRental

    ...as it descibed here ("main form does not hold a reference to the SofiaCarRental namespace") doesn't help.

  13. 56D2ACB1-641E-4F5B-8DB7-07F3B119E643
    56D2ACB1-641E-4F5B-8DB7-07F3B119E643 avatar
    2 posts
    Member since:
    Apr 2016

    Posted 04 Apr 2016 in reply to 967929D9-B818-4E5D-A69B-6BFF0B9547D4 Link to this post

    I've used

    Private _context As SofiaCarRentalModel.FluentModel
    Me._context = New FluentModel(FluentModel.GetBackendConfiguration)

    instead of

    Private _context As SofiaCarRentalContext
    Me._context = New SofiaCarRentalContext()

     

    And another one fix I've made in FluentModelMetadataSource.vb file in SetContainerSettings sub:

    container.DefaultNamespace = "SofiaCarRentalModel"
    container.RootNamespace = "SofiaCarRentalModel"

    instead of

    container.DefaultNamespace = "SofiaCarRentalModel.VB"
    container.RootNamespace = "SofiaCarRentalModel.VB"

    And now it works!

Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.