Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:35:15+00:00 2026-06-17T08:35:15+00:00

In my working WPF application I already have my model and sqlce database. However

  • 0

In my working WPF application I already have my model and sqlce database.
However now I use normal parameterized queries to retrieve, update or delete my data.

Can I still use the Entity Framework for this or is it too late? My model implements INotifyChangedProperty (MVVM application).

An example of the insert method in my AddressModel as is now. I would like to change this using the Entity Framework.

    public int InsertNewAddress(bool isnew)
{
  IsNew = isnew;
  try
  {
    ArrayList paramList = new ArrayList();
    paramList.Add(new SqlCeParameter() { ParameterName = "@Id", Value = Id, DbType = DbType.Guid, Size = 16, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@Street", Value = Street, DbType = DbType.String, Size = 50, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@Number", Value = Number, DbType = DbType.String, Size = 10, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@Bus", Value = DBNull.Value, DbType = DbType.String, Size = 5, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@ZipCode", Value = Zipcode, DbType = DbType.String, Size = 10, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@City", Value = City, DbType = DbType.String, Size = 50, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@Created", Value = DateTime.Now, DbType = DbType.DateTime, Size = 23, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@Modified", Value = DateTime.Now, DbType = DbType.DateTime, Size = 23, Direction = ParameterDirection.Input });
    paramList.Add(new SqlCeParameter() { ParameterName = "@Country", Value = Country, DbType = DbType.String, Size = 50, Direction = ParameterDirection.Input });

    StringBuilder sb = new StringBuilder();

    if (IsNew) // new address, insert
    {
      sb.Append("INSERT INTO [RF_Address] ");
      sb.Append("([Id],[Street],[Number],[Bus],[ZipCode],[City] ,[DateCreated],[DateModified], [Country]) ");
      sb.Append("VALUES ");
      sb.Append("(@Id, @Street, @Number, @Bus, @ZipCode, @City, @Created, @Modified, @Country)");
    }
    else
    {
      sb.Append("UPDATE  [RF_Address] ");
      sb.Append("SET ");
      sb.Append("[Street] = @Street, [Number] = @Number, [Bus] = @Bus, [ZipCode] = @ZipCode, [City] = @City, ");
      sb.Append("[DateModified] = @Modified,  [Country] = @Country ");
      sb.Append("WHERE [Id] = @Id");
    }

    int result = SqlCeHelper.ExecuteNonQuery(sb.ToString(), paramList);
    if (result != 1)
      throw new CustomException("Insert address failed!");

    return result;
  }
  catch (CustomException appEx)
  {
    throw new CustomException(appEx.Message, appEx);
  }
  catch (Exception ex)
  {
    throw new Exception("Error InsertNewAddress: " + ex.Message, ex);
  }
}

thx!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:35:16+00:00Added an answer on June 17, 2026 at 8:35 am

    Yes, you can.

    Entity Framework has three workflows: Database First, Model First and Code First, so among the three you can use Database First

    • Entity Framework Database First (with tutorial)
    • Which workflow should I use?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on WPF application, and now I have to choose which database
I have a WPF Image control already working in my application. Using ScaleTransform and
I'm working on a WPF application and I'm using the MVVM pattern. I use
I am working on a wpf application. Here I need to use System.Windows.Forms.FolderBrowserDialog in
I'm building a WPF application and working with the MVVM pattern. I have 4
I have a WPF application using MVVM that utilises TreeViewItemViewModels to simplify working with
I have a working WPF application. I would like to see it running as
I am working on c# wpf application. I have created a sample client and
I am working on WPF application. I have a window which has Combobox and
I am working on the WPF application and i have created an exe file.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.