Entity structure Example of a provider provider .. How to initialize and configure, please help!

I am trying to figure out how to use ProfileProviderwhich in this example: http://www.codeproject.com/KB/aspnet/AspNetEFProviders.aspx

I have membership and role providers that work just fine, I have everything to configure exactly how it is in this example.

The following is a class that I use in the same way as membership and role classes. This, in turn, will be called by my AccountController.

public class AccountProfileService : IProfileService
{
    private readonly EFProfileProvider _provider;

    public AccountProfileService() : this(null) {}

    public AccountProfileService(ProfileProvider provider)
    {
        _provider = (EFProfileProvider)(provider ?? [What do I put here?!]);
    }

    public void SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection properties)
    {
        if (context == null) throw new ArgumentException("Value cannot be null or empty.", "context");
        if (properties == null) throw new ArgumentException("Value cannot be null or empty.", "properties");

        _provider.SetPropertyValues(context, properties);
    }
}

In the above code, find [What did I put here ?!]. This is what I came across.

null, : Membership.Provider, Role.Provider, Profile.Provider, , , , .

, ?

+5
1

. , ..

..

<profile enabled="true"

defaultProvider="CustomProfileProvider">



<providers>

    <clear /> 
    <add

        name="CustomProfileProvider"

        type="Providers.CustomProfileProvider, Providers"

        ApplicationName="Test" />

</providers>



<properties>

    <add name="ZipCode" allowAnonymous="false" />

    <add name="Phone" allowAnonymous="false" />

</properties>

, , web.config.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Profile;

namespace blahh.Web.Source
{
    class Class1 : ProfileProvider
    {
        public override int DeleteInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            throw new NotImplementedException();
        }

        public override int DeleteProfiles(string[] usernames)
        {
            throw new NotImplementedException();
        }

        public override int DeleteProfiles(ProfileInfoCollection profiles)
        {
            throw new NotImplementedException();
        }

        public override ProfileInfoCollection FindInactiveProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            throw new NotImplementedException();
        }

        public override ProfileInfoCollection FindProfilesByUserName(ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {
            throw new NotImplementedException();
        }

        public override ProfileInfoCollection GetAllInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate, int pageIndex, int pageSize, out int totalRecords)
        {
            throw new NotImplementedException();
        }

        public override ProfileInfoCollection GetAllProfiles(ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
        {
            throw new NotImplementedException();
        }

        public override int GetNumberOfInactiveProfiles(ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
        {
            throw new NotImplementedException();
        }

        public override string ApplicationName
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override System.Configuration.SettingsPropertyValueCollection GetPropertyValues(System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyCollection collection)
        {
            throw new NotImplementedException();
        }

        public override void SetPropertyValues(System.Configuration.SettingsContext context, System.Configuration.SettingsPropertyValueCollection collection)
        {
            throw new NotImplementedException();
        }
    }
}

http://www.davidhayden.com/blog/dave/archive/2007/10/30/CreateCustomProfileProviderASPNET2UsingLINQToSQL.aspx .

mysql .net, .

http://www.codeproject.com/KB/aspnet/AspNetEFProviders.aspx?display=Print

, , - , , .

+2

All Articles