Search code examples
c#databaselinq-to-sqlwindows-phone-8

Can I work with local database without LINQ to SQL in WP8?


I trying to make simple WP8 application. In MSDN I found an example for working with local database. But in this example using LINQ TO SQL. I dislike LINQ to SQL and my question:

Can I work with local database without LINQ to SQL in WP8? For example, I want to use a code style like that:

IRepository{
   TestItem GetTestItem();
}

SQLCERepository:IRepository{
    public TestItem GetTestItem(){
        TestItem result=null;
       //making "select id, name from TEST_ITEM"
       //mapping "select" result into TextItem class
       return result;
    }   
}

Solution

  • No, you can't:

    ExecuteCommand is not supported: Windows Phone does not support executing “raw” Transact-SQL, Data Definition Language (DDL), or Data Modeling Language (DML) statements.

    (source)

    That is, you can't directly access the Transact-SQL database software built into Windows Phone 8. You can, however, add database SDKs to access other kinds of SQL databases, for example SQLite.