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 7540813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:43:53+00:00 2026-05-30T07:43:53+00:00

I am using SQL Server 2012 RC0 + EF 4 + MVC 4. 90%

  • 0

I am using SQL Server 2012 RC0 + EF 4 + MVC 4. 90% of my db is made with Code First funcionality of EF.

I am going to use some CLR functions for regular expressions, as described here and other articles.

As I stated, I am using EF Code First, so I take advantage of this funcionality, creating db on first use and executing some additional SQL commands for making indexing, constraints, SQL computed fields and SQL functions.

This is an example of my Seed funcion on first use:

public class mydbInitializer : DropCreateDatabaseIfModelChanges<TManagerContext>
   {
    protected override void Seed(mydbContext context)
    {
        try
        {
            context.Database.ExecuteSqlCommand("CREATE NONCLUSTERED INDEX IX_index1 ON table1 (field1)");
            context.Database.ExecuteSqlCommand("CREATE NONCLUSTERED INDEX IX_index2 ON table1 (field2)");
            ...

// here I would put some code to Enable CLR on SQL Server and deploy my CLR functions into it….

I would deploy my app to different server, so I was wondering if it was possible to enable CLR and deploy CLR functions at first use of the application? For safety reasons, then I would go to replace the bins with versions that do not involve the creation or drop the db.

Do you think it is a wrong approach? Should I necessarly need to use SQL Management Studio? Alternatively, you can create batch to facilitate the integration of the CLR and its bins?

Thank you very much for your help and sorry for my bad English.
Best Regards

  • 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-30T07:43:54+00:00Added an answer on May 30, 2026 at 7:43 am

    Yes, it is possible. Enabling SQLCLR can be done by running sp_configure:

    exec sp_configure 'clr_enabled', 1;
    reconfigure;
    

    To load an assembly into the database straight from code use CREATE ASSEMBLY <name> FROM @bits; and as as @bits pass in the assembly DLL stream. You can add the SQLCLR assembly to your application as a resource or as a dependency, both allow you to retrieve a stream to the assembly DLL and pass this in as a SqlBytes argument for @bits.

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

Sidebar

Related Questions

Using SQL Server, which is the fastest or best practice method to use for
Using SQL Server, how do I split a string so I can access item
Using sql server 2000, I would like to take my production data and put
Using SQL Server 2005 and Management Studio how do I insert a picture into
[using SQL Server 2005] I have a table full of users, I want to
Using SQL Server 2000 Table PersonID Date 001 11-02-2009 002 11-02-2009 003 11-02-2009 001
Using SQL Server 2000 My Query. SELECT (Format(IIf(CLng(OutTime) > 180000, CDate('18:00:00'), CDate(Format(OutTime, '00:00:00'))) -
Using SQL Server 2005 Database1 Table1 ID Date Status 001 23-02-2009 Worked 001 24-02-2009
Using SQL Server 2005 I want to filter the column where column value not
Using SQL Server 2005, how can I authenticate a username/password pair against a non-AD

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.