developerz
2007-12-21T12:48:48Z
Has anyone been able to get the Sql Table Profile Provider to work YAF 1.9.3 ?

I'm running into a couple problems.

The first problem I'm facing is that if I have Gender defined as a profile property in the web.config I get a configuration error, because I think "Gender" is already defined in YAF profile somewhere(?).

Here's the error msg:
UserPostedImage

Now if I remove Gender profile property from my web.config, I then get another error that seems to be related to a profile confict with YAF.

Here's the error msg:
UserPostedImage

This error will go away, and my site will work if I remove: inherits="YAF.Classes.Utils.YafUserProfile" from


<profile enabled="true" defaultProvider="MyTableProfileProvider" inherits="YAF.Classes.Utils.YafUserProfile">
      <providers>
        <clear/>
        <add name="MyTableProfileProvider" connectionStringName="yafnet" applicationName="YetAnotherForumApp" type="Microsoft.Samples.SqlTableProfileProvider" table="custom_CustomProfileTable" />
        <!--
        <add name="MyStoredProcedureProfileProvider" 
                 type="Microsoft.Samples.SqlStoredProcedureProfileProvider" 
                 connectionStringName="DBConnString" 
                 setProcedure="custom_SetCustomProfileData" 
                 readProcedure="custom_GetCustomProfileData" 
                 applicationName="ShipwreckWorldApp"/>
                 -->
      </providers>
      <properties>
        <!-- config for table provider -->
        <add name="FirstName" defaultValue="[null]" customProviderData="FirstName;nvarchar"/>
        <add name="LastName" defaultValue="[null]" customProviderData="LastName;nvarchar"/>
        <!-- Can't use Gender property because it conflicts with YetAnotherForum profile properties -->
        <!-- <add name="Gender" defaultValue="[null]" customProviderData="Gender;bit"/> -->


      </properties>
    </profile>




If anyone has got the SqlTableProfileProvider to work, please let me know how you got it to work!!!
Thanks,
d.
Sponsor
developerz
2007-12-21T16:08:48Z
I set up a new test site using the sample SQL Table Profile Provider website and YAF. Unfortunately, I'm getting the following error when clicking on the "My Profile" navigation link:

Unable to cast object of type 'ProfileCommon' to type 'YAF.Classes.Utils.YafUserProfile'.


Stack Trace: 


[InvalidCastException: Unable to cast object of type 'ProfileCommon' to type 'YAF.Classes.Utils.YafUserProfile'.]
   YAF.Classes.Utils.YafContext.GetProfile(String userName) +35
   YAF.Classes.Utils.YafCombinedUserData.InitUserData() +115
   YAF.Classes.Utils.YafCombinedUserData..ctor(MembershipUser membershipUser, Int32 userID) +63
   YAF.Classes.Utils.YafCombinedUserData..ctor(Int32 userID) +37
   YAF.Controls.ProfileYourAccount.BindData() +116
   YAF.Controls.ProfileYourAccount.Page_Load(Object sender, EventArgs e) +21
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061

 

Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2007-12-21T20:22:50Z
YAF profile class uses "custom data" and it's not compatible with SQL Table Profile Provider. I will make it compatible since it's pretty simple.
developerz
2007-12-22T07:22:55Z
Jaben-

Any chance you'll be able to make it compatible before Dec. 25th? You'd seriously be the "man" if you were able to get it coded before then, but I understand if it might take a little longer.

Thanks for your help,
d.
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2007-12-23T02:28:27Z
developerz wrote:

Jaben-

Any chance you'll be able to make it compatible before Dec. 25th? You'd seriously be the "man" if you were able to get it coded before then, but I understand if it might take a little longer.

Thanks for your help,
d.



I fixed issue in the latest release. It *should* work but I didn't actually test it with the SQL Table Provider.

Anyway, give is a shot and let me know.
developerz
2007-12-23T10:18:55Z
Jaben... you da' Man! The Sql Table Profile Provider is now working!

Couple things: First, you need to add "Gender" column with Data Type 'int' and "Birthday" column with Data Type 'datetime' to the dbo.ProfileTable_1 (when using the sample database from Sql Table Profile Provider). But don't add Gender or Birthday to the Profile properties in the web.config. If you uncomment Gender or Birthday in the code below you'll get a Configuration error, stating "This profile property has already been defined."

<profile enabled="true" defaultProvider="TableProfileProvider" inherits="YAF.Classes.Utils.YafUserProfile">
			<providers>
				<clear/>
        
				<add name="TableProfileProvider" 
                         type="Microsoft.Samples.SqlTableProfileProvider" 
                         connectionStringName="yafnet" 
                         table="ProfileTable_1" 
                         applicationName="YetAnotherForumApp"/>
        <!--
                <add name="StoredProcedureProfileProvider" 
                         type="Microsoft.Samples.SqlStoredProcedureProfileProvider" 
                         connectionStringName="yafnet" 
                         setProcedure="setCustomProfileData" 
                         readProcedure="getCustomProfileData" 
                         applicationName="YetAnotherForumApp"/> -->       
			</providers>
			<properties>
                <!-- config for table provider -->
        
				<add name="FirstName" type="string" defaultValue="[null]" customProviderData="FirstName;nvarchar"/>
				<add name="LastName" type="string" defaultValue="[null]" customProviderData="LastName;nvarchar"/>
        <add name="Age" type="int" customProviderData="Age;int"/>
        <!-- <add name="Gender" type="int" customProviderData="Gender;int"/> -->
        <!-- <add name="Birthday" type="DateTime" customProviderData="Birthday;DateTime"/> -->
                <!-- config for stored procedure provider -->
                <!--
				        <add name="FirstName" defaultValue="[null]" customProviderData="FirstName;nvarchar;50"/>
				        <add name="LastName"  defaultValue="[null]" customProviderData="LastName;nvarchar;50"/>
                <add name="Age" type="int" customProviderData="Age;int;1"/>
                -->
			</properties>
		</profile>



It seems strange that you have to add only "Gender" and "Birthday" to the dbo.ProfileTable_1

Just looking at the UserProfile.cs file, it appears that only Gender and Birthday are the only properties that are NOT a NVARCHAR data type, ex:

Location;nvarchar;255
Homepage;nvarchar;255
MSN;nvarchar;255
YIM;nvarchar;255
AIM;nvarchar;255
ICQ;nvarchar;255
GoogleTalk;nvarchar;255
Skype;nvarchar;255
Blog;nvarchar;255
BlogServiceUrl;nvarchar;255
BlogServiceUsername;nvarchar;255
BlogServicePassword;nvarchar;255
RealName;nvarchar;255
Occupation;nvarchar;400
Interests;nvarchar;400
Gender;int
Birthday;DateTime



Anyway, thanks so much for getting things to work!!!
daCodez
2010-03-05T12:13:36Z
I keep getting this error when using SqlStoredProcedureProfileProvider does anyone know why?
Could not load type 'SqlStoredProcedureProfileProvider'. (C:\www\YAF\YAF-v1.9.4-RC1-SRC\YetAnotherForum.NET\web.config line 114). Please help as this is URGENT.

I've gone through all the documentation on integrating with my existing membership and have also implemented the fix here and i can't seem to get it to work.


This is my Profile Code.
<profile inherits="YAF.Classes.Utils.YafUserProfile" enabled="true" defaultProvider="SqlStoredProcedureProfileProvider" automaticSaveEnabled="false">
<providers>
<clear />
<add connectionStringName="yafnet" applicationName="/" setProcedure="sp_Profile_Set_Properties" readProcedure="sp_Profile_Get_Properties" name="SqlStoredProcedureProfileProvider" type="SqlStoredProcedureProfileProvider" />
</providers>
<properties>
<add name="First_Name" type="string" customProviderData="First_Name;nvarchar;255" allowAnonymous="false"/>
<add name="Last_Name" type="string" customProviderData="Last_Name;nvarchar;255" allowAnonymous="false"/>
<add name="Name_Prefix" type="string" customProviderData="Name_Prefix;nvarchar;5" allowAnonymous="false"/>
<add name="Address_Line_1" type="string" customProviderData="Address_Line_1;nvarchar;255" allowAnonymous="false"/>
<add name="Address_Line_2" type="string" customProviderData="Address_Line_2;nvarchar;255" allowAnonymous="false"/>
<add name="City" type="string" customProviderData="City;nvarchar;50" allowAnonymous="false"/>
<add name="Postal_Code" type="string" customProviderData="Postal_Code;nvarchar;20" allowAnonymous="false"/>
<add name="Province_ID" type="integer" customProviderData="Province_ID;int;8" allowAnonymous="false"/>
<add name="Country_ID" type="string" customProviderData="Country_ID;nvarchar;5" allowAnonymous="false"/>
<add name="Email" type="string" customProviderData="Email;nvarchar;256" allowAnonymous="false"/>
<add name="Last_Updated_Date" type="datetime" customProviderData="Last_Updated_Date;datetime;8" allowAnonymous="false"/>
<add name="Location_ID" type="string" customProviderData="Location_ID;nvarchar;15" allowAnonymous="false"/>
<add name="ImageID" type="integer" customProviderData="ImageID;int;8" allowAnonymous="false"/>
</properties>
</profile>

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved