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

  • SEARCH
  • Home
  • 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 7187317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:49:08+00:00 2026-05-28T18:49:08+00:00

My workflow has been to develop models incrementally using EF designer and generating the

  • 0

My workflow has been to develop models incrementally using EF designer and generating the database from that model as I progress.

Recently I wanted a computed column so I made a string property, set StoreGeneratedPattern=Computed, and manually changed the generated DDL to be a computed column. This passes its test.

However, if I regenerate the database from the model later, I would have to re-manually change the computed column, and that isn’t really worth the effort.

After browsing Google a bit, I couldn’t find a solution, but managed to come up with using a DDL trigger.

I am curious if there is another, non DDL trigger method of acomplishing the same thing.

Update: I decided to go with the DDL trigger solution below, though I’m still interested if this is unnecessary, but I suspect my problem comes from being in the minority with my workflow style and most others don’t have this issue because they generate the model from the database…

--
-- DDL Trigger for CREATE TABLE
--
alter trigger ddltrigCreateTable
on database
for create_table
as
    --
    -- Table DirectTrackInfoes
    --
    if EVENTDATA().value('(/EVENT_INSTANCE/ObjectName)[1]','nvarchar(max)')='DirectTrackInfoes'
    begin
        --
        -- Computed Column BaseUrl
        --
        alter table DirectTrackInfoes
        drop column BaseUrl
        alter table DirectTrackInfoes
        add BaseUrl as ((N'https://'+[ClientDomain])+N'/apifleet/rest')
        --
        -- Initial data
        --
        insert into [DirectTrackInfoes] ([Version], [ClientDomain], [ClientId], [AccessId], [UserName], [Password])
        values (N'1_0', N'foo.com', 9999, 1, N'', N'')
    end
    --
    -- Table HttpMethods
    --
    if EVENTDATA().value('(/EVENT_INSTANCE/ObjectName)[1]','nvarchar(max)')='HttpMethods'
    begin
        --
        -- Initial data
        --
        insert into HttpMethods (MethodName)
        values (N'GET'), (N'POST'), (N'PUT'), (N'DELETE')
    end
    go
  • 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-05-28T18:49:09+00:00Added an answer on May 28, 2026 at 6:49 pm

    Using DDL trigger to handle this situation is really not a good idea. If you want to avoid deletion of your existing changes to the database build your database in real incremental way (without deleting current state). This is possible for example with Database Generation Power Pack (you must have at least VS 2010 Premium with database features). There are other supporting tools allowing incremental DB development like Huagati EDMX tools or LLBGen Designer but those tools are usually commercial.

    Another more complex option is adding your database customization directly to your EDMX. If anybody comes to your application he should be able to generate database from model and use it without any further steps. Achieving this is little bit complex but it is possible. Check this answer about changing data type in database – same approach can be used for adding any other customization into your database generation workflow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My team has been tasked with designing a web application that is workflow driven.
I have a skelta workflow that has finished with errors according to the WorkflowExecutionReport.
I have a fairly straight-forward sequential approval workflow that has an EnableModificationActivity that is
Recently I had to develop a SharePoint workflow, and I found the experience quite
Basically, I have a point in my workflow where after a document has been
Spring Workflow has now been published. Have you tried it yet? For what kind
Much has been written here about developing a workflow in R for statistical projects.
I have an iphone app that has been downloaded in the last two months
What is a good workflow for using mercurial with two long-running branches that are
I have a custom tracking service that has been running for a while now

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.