How to change column name in Users table?

Topics: Administration, Core, Customizing Orchard, Writing modules
Nov 13, 2012 at 12:29 PM
Edited Nov 13, 2012 at 12:31 PM

Hi, I want to migrate from MWPSK CMS to Orchard CMS.  And I have already users table (in mysql).

For login and password I use another names than orchard.

At the same time I can't simply copy that data into orchard table ( because of another programs), so I have to change Orchard user table name and column names for login, password, email and so on. How can I do it?

Thanks in advace.


Nov 15, 2012 at 9:56 AM

You need to create your own implementation of IMembershipService to handle this.

Take a look at this answer on StackOverflow which should help get you started. There are also a few related topics in these forums if you search for "custom imembership".

Nov 15, 2012 at 11:53 AM
Edited Nov 15, 2012 at 11:55 AM

Thank you kobowi for reply. Yes I tired to search right solution. I also find this topics: 1 and 2nd  .

So I decided to override MembershipService

 But when I decided to create new module with Orchard 1.6 I got error:

orchard> feature enable Orchard.CodeGeneration
Enabling features Orchard.CodeGeneration
Code Generation was enabled

orchard> codegen module Orchard.TestTestModule

Error executing command "codegen module Orchard.TestTestModule"

No command found matching arguments "codegen module ....

Now I faced with bug . For newbies it's little hard to enter into orhard ideology...

Workaround is to copy an existing module but I'm not sure I made the right - I got such error when enable/disable module in dashboard:


Orchard.Environment.Extensions.ExtensionLoaderCoordinator: WARN - No loader found for extension "Orchard.InspireUsers"!
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll
A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll


My module structure:

Free Image Hosting at

 and in InspireMembershipService.cs file I just created new class:


public class InspireMembershipService : MembershipService , IDependency 

so what's next I have to do? Maybe someone can give me some example with such custom membership provider? Thanks in advance.





Nov 15, 2012 at 12:39 PM
Edited Nov 15, 2012 at 12:40 PM

I've not upgraded any of my sites/devel projects to 1.6 yet so can't comment on your codegen problem. Your module structure looks alright, but InspireMembershipService should implement IMembershipService, not inherit from MembershipService. You then need to implement all the methods of IMembershipService (if you copy and paste the definition below, click on "IMembershipService", then press Ctrl-. VS will generate some stubs for you.

public class InspireMembershipService : IMembershipService

You might also need to decorate your implementation with an attribute...

public class InspireMembershipService : IMembershipService {
// Implementation here...

... to ensure that your implementation is used in place of the default one.

Then you just need to implement each method, which will be dependent on your database. I've not written anything to communicate with external databases so can't offer any advice, but there are a couple of threads on the topic:

Good luck!

Nov 16, 2012 at 5:30 PM

Codegen problem is a known issue: