locked
Update membership - aspnetdb.mdf RRS feed

  • Question

  • User851852702 posted

     Hi,

     

    I am trying to make a profile update page for my membership (aspnetdb.mdf), Since the membership is an API, and aspnetdb.mdf is read only, when I try to bind to a sqldatasource, how do I create a business object layer so I can access all the membership methods?

     

    Thanks

     

    Monday, November 10, 2008 8:53 AM

Answers

  • User1716267170 posted

    Thanks for your followup Bonekrusher.

    Basically, you can achieve it like this:

    [System.ComponentModel.DataObject(true)]
    public class TEST
    {
         [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Insert, true)]
         public void InsertUser(string username, string password, string email)
         {
             Membership.CreateUser(username, password, email);
         }
    
         // Others are ignored
    }
    Best regards. 
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 13, 2008 10:15 PM

All replies

  • User851852702 posted

     

    Not everyone at once!

     

     

    Wednesday, November 12, 2008 9:15 AM
  • User1716267170 posted

    Hi Bonekrusher,

    If you want to use SqlDataSource, you have no need to use the Membership API, you only have to specify the SQL queries. However, if you use ObjectDataSource, I think you need to write a middle class to encapsulate the Membership API. You may not use the Membership API directly.

    Thanks.

    Thursday, November 13, 2008 1:59 AM
  • User851852702 posted

    Hi Wencui Qian,

    Thanks for the help. I want to use the objectDataSource to update, insert etc.. (not view). How do I create a Middle tier class to encapsulte the membership api? Right now, I am using the api to access all the methods. Everything works fine, put it was alot of coding.

     

    Thanks,

    Bones

    Thursday, November 13, 2008 7:45 AM
  • User1716267170 posted

    Thanks for your followup Bonekrusher.

    Basically, you can achieve it like this:

    [System.ComponentModel.DataObject(true)]
    public class TEST
    {
         [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Insert, true)]
         public void InsertUser(string username, string password, string email)
         {
             Membership.CreateUser(username, password, email);
         }
    
         // Others are ignored
    }
    Best regards. 
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 13, 2008 10:15 PM
  • User851852702 posted

     Perfect!

     May I asked the following?

    What exactly does "<System.ComponentModel.DataObject(True)> _" do? Can you explain the methodology?

    Friday, November 14, 2008 7:45 AM
  • User1716267170 posted

    Thanks for your followup, Bonekrusher. The System.ComponentModel.DataObject attribute marks the class as being an object suitable for binding to an ObjectDataSource control.

    Sunday, November 16, 2008 2:16 AM
  • User851852702 posted

    The System.ComponentModel.DataObject attribute marks the class as being an object suitable for binding to an ObjectDataSource control.

    Thanks Again!

    Monday, November 17, 2008 11:08 AM