I got it to work! Yay!
However there is some substantial change of how RhinoSecurity is
suppose to set up. The example that Artur use an older version of
RhinoSecurity so Security.InitializeConfiguration<YourUserImpl>(cfg)
wasn't available then.
If Security.InitializeConfiguration<YourUserImpl>(cfg) is used then
there is no need to Include the RhinoSecurity assembly into the
hibernate config file. In fact doing so will resulted in a duplicate
mapping error.
I actually got it set up correctly the first time.
However I couldn't get it to work because I used
SecurityTableStructure.Schema this is the part that I don't really
understand what is all that require if I used this instead of
SecurityTableStructure.Prefix. If somebody could explain the different
that would be great.
Anyway it's working when I changed to SecurityTableStructure.Prefix.
It's also worth noting that SchemaUpdate will fail silently(which sent
me on a wild goose chase) while SchemaExport will throw an exception
when I tried to use SecurityTableStructure.Schema
Here is the exception that got throw when I attempted to do a
SchemaExport with the SecurityTableStructure.Schema settting.
NHibernate.HibernateException was unhandled
Message="The specified schema name \"security\" either does not
exist or you do not have permission to use it."
Source="NHibernate"
StackTrace:
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Boolean script,
Boolean export, Boolean justDrop)
at NHibernate.Tool.hbm2ddl.SchemaExport.Create(Boolean script,
Boolean export)
at RhinoSecurity.Program.Main(String[] args) in
C:\Users\Hummy\Desktop\example\RhinoSecNhSetup\RhinoSecurity\RhinoSecurity\Program.cs:line
34
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Data.SqlClient.SqlException
Message="The specified schema name \"security\" either does not
exist or you do not have permission to use it."
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
Class=16
LineNumber=1
Number=2760
Procedure=""
Server="localhost\\SQLEXPRESS"
State=1
StackTrace:
at System.Data.SqlClient.SqlConnection.OnError(SqlException
exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
exception, Boolean breakConnection)
at
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject
stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior
runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String
methodName, Boolean async)
at
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult
result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean throwOnError, TextWriter
exportOutput, IDbCommand statement, String sql)
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop, IDbConnection
connection, TextWriter exportOutput)
at NHibernate.Tool.hbm2ddl.SchemaExport.Execute(Action`1
scriptAction, Boolean export, Boolean justDrop)
InnerException:
On Sun, Nov 29, 2009 at 2:47 AM, Ayende Rahien <[email protected]> wrote:
> I think that you forgot to user
> Security.InitializeConfiguration<YourUserImpl>(cfg)
>
> On Sun, Nov 29, 2009 at 10:35 AM, Firefly <[email protected]> wrote:
>>
>> I have uploaded the file into the file pool that will throw an
>> exception that say something like this...
>>
>> NHibernate.MappingException was unhandled
>> Message="An association from the table Permissions refers to an
>> unmapped class: Rhino.Security.IUser"
>> Source="NHibernate"
>>
>>
>> The source is a modified version of the tutorial by Artur that can be
>> found here
>> http://weblogs.asp.net/arturtrosin/archive/2009/04/02/rhino-tools-rhino-security-guide.aspx
>>
>> The relevance part of this error come from this part of the source
>>
>> internal class NHibernateDbSchemaGeneration :
>> INHibernateInitializationAware
>> {
>> public void BeforeInitialization()
>> {
>> }
>>
>> public void Configured(Configuration cfg)
>> {
>> //new SchemaExport(cfg).Create(true, true);
>>
>> var cfg1 = new Configuration();
>> cfg1.Configure();
>>
>> //why is that if I am using my own Configuration file I get
>> that error?
>> var db = new SchemaExport(cfg1);
>> db.Create(true, true);
>> }
>>
>> public void Initialized(Configuration cfg, ISessionFactory
>> sessionFactory)
>> {
>> }
>> }
>>
>>
>> The error only happen when I created my own configuration object and
>> not when I use the cfg object that got passed in by the container.
>>
>> I looked in the watch windows and base on my limited knowledge they
>> look very much the same. Is there something else that I need to do in
>> creating a new configuration object?
>> it probably something simple but fundamental that I am missing. This
>> set up have worked for me before. I only got an error today when I try
>> to incorporate Rhino into my project.
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Rhino Tools Dev" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/rhino-tools-dev?hl=en.
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Rhino Tools Dev" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rhino-tools-dev?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en.