getting it to work

57 views
Skip to first unread message

H.Alex

unread,
Apr 14, 2011, 11:25:19 AM4/14/11
to ConfORM
am i the only retard on the planet that cant get it to work?

what's wrong with this?

var entities = new[] { typeof(Customer),
typeof(CustomerPreferences), typeof(Order) };
var orm = new ObjectRelationalMapper();
orm.TablePerClass(entities);
var mapper = new Mapper(orm);
var mapping = mapper.CompileMappingFor(entities);

_cfg = new Configuration(); //NH config
_cfg.Configure();

_cfg.Properties[NHibernate.Cfg.Environment.CollectionTypeFactoryClass]
= typeof(WpfCollectionTypeFactory).AssemblyQualifiedName;
_cfg.AddDeserializedMapping(mapping, null);

new SchemaExport(_cfg).Create(true, true);
_sessionFactory = _cfg.BuildSessionFactory();

shema export fails with this below while normal nh using hbm.xml's
works fine with the same code above

NHibernate.HibernateException was unhandled
Message=Could not create the driver from
NHibernate.Driver.SqlServerCeDriver.
Source=NHibernate
StackTrace:
at
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2
settings)
at
NHibernate.Connection.ConnectionProvider.Configure(IDictionary`2
settings)
at
NHibernate.Connection.ConnectionProviderFactory.NewConnectionProvider(IDictionary`2
settings)
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 AgilePlayground.Tests.ConfORM_Fixture.TestFixtureSetUp() in
C:\Users\Aleksandar\Documents\Visual Studio 2010\Projects
\AgilePlayground\AgilePlayground.Tests\ConfORM_Fixture.cs:line 29
at AgilePlayground.App.Application_Startup(Object sender,
StartupEventArgs e) in C:\Users\Aleksandar\Documents\Visual Studio
2010\Projects\AgilePlayground\AgilePlayground\App.xaml.cs:line 38
at System.Windows.Application.OnStartup(StartupEventArgs e)
at System.Windows.Application.<.ctor>b__1(Object unused)
at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
callback, Object args, Int32 numArgs)
at
MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object
source, Delegate method, Object args, Int32 numArgs, Delegate
catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at
System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object
state)
at System.Threading.ExecutionContext.runTryCode(Object
userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode
code, CleanupCode backoutCode, Object userData)
at
System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd,
Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr
wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
callback, Object args, Int32 numArgs)
at
MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object
source, Delegate method, Object args, Int32 numArgs, Delegate
catchHandler)
at
System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority
priority, TimeSpan timeout, Delegate method, Object args, Int32
numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32
msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at
System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame
frame)
at
System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at AgilePlayground.App.Main() in C:\Users\Aleksandar\Documents
\Visual Studio 2010\Projects\AgilePlayground\AgilePlayground\obj
\x86\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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, Boolean
ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.Reflection.TargetInvocationException
Message=Exception has been thrown by the target of an
invocation.
Source=mscorlib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType
type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached,
RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean
publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean
publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis,
Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean
nonPublic)
at System.Activator.CreateInstance(Type type)
at
NHibernate.Bytecode.ActivatorObjectsFactory.CreateInstance(Type type)
at
NHibernate.Connection.ConnectionProvider.ConfigureDriver(IDictionary`2
settings)
InnerException: NHibernate.HibernateException
Message=The IDbCommand and IDbConnection implementation in
the assembly System.Data.SqlServerCe could not be found. Ensure that
the assembly System.Data.SqlServerCe is located in the application
directory or in the Global Assembly Cache. If the assembly is in the
GAC, use <qualifyAssembly/> element in the application configuration
file to specify the full name of the assembly.
Source=NHibernate
StackTrace:
at
NHibernate.Driver.ReflectionBasedDriver..ctor(String
providerInvariantName, String driverAssemblyName, String
connectionTypeName, String commandTypeName)
at
NHibernate.Driver.ReflectionBasedDriver..ctor(String
driverAssemblyName, String connectionTypeName, String commandTypeName)
at NHibernate.Driver.SqlServerCeDriver..ctor()
InnerException:

Aleksandar Hummel

unread,
Apr 14, 2011, 5:28:49 PM4/14/11
to ConfORM
wrong exception

this is it
NHibernate.HibernateException was unhandled
  Message=There was an error parsing the query. [ Token line number = 1,Token line offset = 14,Token in error = Order ]
  Source=NHibernate
  StackTrace:
  InnerException: System.Data.SqlServerCe.SqlCeException
       Message=There was an error parsing the query. [ Token line number = 1,Token line offset = 14,Token in error = Order ]
       Source=SQL Server Compact ADO.NET Data Provider
       HResult=-2147217900
       NativeError=25501
       StackTrace:
            at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
            at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
            at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
            at NHibernate.Tool.hbm2ddl.SchemaExport.ExecuteSql(IDbCommand cmd, String sql)
            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:

Fabio Maulo

unread,
Apr 14, 2011, 5:58:41 PM4/14/11
to codec...@googlegroups.com
ehm.... this is the ConfORM group not nhusers group.
--
Fabio Maulo

H.Alex

unread,
Apr 14, 2011, 7:42:25 PM4/14/11
to ConfORM
i know. i am sorry i was very upset. i do have a bad temper
sometimes.

but i tried mapping my domain with ConfORM and that attempt is the
topmost code. of course it doesn't work. so i would like to know why.

or.. forget about this question and could you please post a simple
hello world conform mapping from top to bottom as i seem to be stupid
enough not to be able to get it to work. :D

much love,
alex :D


On Apr 14, 11:58 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> ehm.... this is the ConfORM group not nhusers group.
>

Claudio Maccari

unread,
Apr 15, 2011, 2:51:09 AM4/15/11
to codec...@googlegroups.com
There are many samples here:
http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm.UsageExamples/
HTH
m.

--
Claudio Maccari
--------------------------------
http://jitidea.net/
http://twitter.com/jitidea
I do the impossible every day. Miracles take a little longer.

H.Alex

unread,
Apr 15, 2011, 2:28:22 PM4/15/11
to ConfORM
thank you claudio

but none of those show how to actually plug the mapping into nh.

mine doesn't work and i don't know why. code @ top of the thread.

On Apr 15, 8:51 am, Claudio Maccari <claudio.macc...@gmail.com> wrote:
> There are many samples here:http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm.Us...
> --------------------------------http://jitidea.net/http://twitter.com/jitidea

Fabio Maulo

unread,
Apr 15, 2011, 2:30:59 PM4/15/11
to codec...@googlegroups.com

H.Alex

unread,
Apr 15, 2011, 4:52:07 PM4/15/11
to ConfORM
Thank you Fabio <yey I found the shift key>

Still, the example seems to require nh 3.2, and i can't find a ConfORM
version built to 3.2. + will have to wait to get nh.validation built
to nh 3.2 (but I'm nitpicking)

Is there a nh 3.1 example somewhere?

On Apr 15, 8:30 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrmExa...

Fabio Maulo

unread,
Apr 16, 2011, 8:40:26 AM4/16/11
to codec...@googlegroups.com
eh?
That example works with any version from 3.0
--
Fabio Maulo

H.Alex

unread,
Apr 18, 2011, 11:22:38 AM4/18/11
to ConfORM
you are right i missed a couple of usings ..

but i still can't get it to work. im using sql serv ce

in that integration fixture, the SchemaExport test fails on line
SchemaMetadataUpdater.QuoteTableAndColumns(conf);

with

Test 'AgilePlayground.Tests.NHibernate_ConfORM_Fixture.SchemaExport'
failed: System.NotSupportedException : Specified method is not
supported.
at System.Data.Common.DbConnection.GetSchema(String collectionName)
at
NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetReservedWords()
at
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
dialect, IConnectionHelper connectionHelper)
at
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(IDictionary`2
cfgProperties)
at
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.QuoteTableAndColumns(Configuration
configuration)
NHibernate_ConfORM_Fixture.cs(85,0): at
AgilePlayground.Tests.NHibernate_ConfORM_Fixture.SchemaExport()

i am using this for configuration (never used fluent conf b4)

configure.DataBaseIntegration(db =>
{
db.Dialect<NHibernate.Dialect.MsSqlCeDialect>();
db.Driver<NHibernate.Driver.SqlServerCeDriver>();
db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
db.IsolationLevel = IsolationLevel.ReadCommitted;
db.ConnectionString = "Data Source=DataStore.sdf";
db.Timeout = 10;
db.HqlToSqlSubstitutions = "true 1, false 0, yes 'Y',
no 'N'";
});

and this for mapping:

var entities = new[] { typeof(Customer),
typeof(CustomerPreferences), typeof(Order) };
var orm = new ObjectRelationalMapper();
orm.TablePerClass(entities);
var mapper = new Mapper(orm);
var mapping = mapper.CompileMappingFor(entities);
return mapping;

H.Alex

unread,
May 15, 2011, 5:59:15 PM5/15/11
to ConfORM
I can't get it to work with sql serv ce.

I have a test fixture that uses ConfORM for mapping that works with
sql server but not on sql server ce (.sdf file).
That exact same fixture works just fine with hbm's.

I only alternate between these two in my config

<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</
property>
<property
name="connection.driver_class">NHibernate.Driver.SqlClientDriver</
property>
<!--<property name="dialect">NHibernate.Dialect.MsSqlCeDialect</
property>
<property
name="connection.driver_class">NHibernate.Driver.SqlServerCeDriver</
property>-->

And pass a different connection string.

Is SQL serv ce supported by ConfORM?

Best regards,
Alex.
> ...
>
> read more »

Fabio Maulo

unread,
May 16, 2011, 7:05:55 AM5/16/11
to codec...@googlegroups.com
ConfORM does not supports neither MsSql 2008 nor Oracle nor MsSqlCe as
any other RDBMS.
ConfORM simply produce mappings.
If a mappig works for MsSql and does not work for MsSqlCe that mean
that there are some patter-applier that should not apply for MsSqlCe.
You can easly disable those patterns-applier using "composition" (an
example is available on UsageExample).

--
Fabio Maulo

H.Alex

unread,
May 16, 2011, 1:32:57 PM5/16/11
to ConfORM
I had to remove a call to
NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.QuoteTableAndColumns(Configuration
configuration)

and disable auto-quote and now it works on sql ce.

On May 16, 1:05 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> ConfORM does not supports neither MsSql 2008 nor Oracle nor MsSqlCe as
> any other RDBMS.
> ConfORM simply produce mappings.
> If a mappig works for MsSql and does not work for MsSqlCe that mean
> that there are some patter-applier that should not apply for MsSqlCe.
> You can easly disable those patterns-applier using "composition" (an
> example is available on UsageExample).
>
> --
> Fabio Maulo
>
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages