What's the difference between
Configuration.Configure(string)//Configure NHibernate using the file specified.
and
Configuration.AddXmlFile(string)//Read mappings from a particular XML file.
?
It looks like the latter's functionality is a subset of the former's, but does anyone care to elaborate?
The first one is to configure dialect, driver and other configurations properties.
The second is used if you want to append an additional XML mapping (HBM) file to an existing configuration object.
For example, create a Configuration using FluentNHibernate then append a classic XML mapping (when migrating legacy NH application to FNH, for example).
Related
I recently setup a dev site and am using IdentityServer3 with IdentityManager, both from thinktecture, and IdentityManager is designed to create the database for itself, but can be configured to work with an existing db. I was able to get IdentityManager into a local db I had previously created with the default schema, but I would like to switch it to a new schema. Basically the question is that I can't figure out how to set the desired schema in the db in IdentityManager and can anyone in here give any insight?
There are many ways to do this (idsrv3 is very configurable). A common way is to add the MembershipReboot package, subclassing the MembershipReboot factory classes, and then loading your new factories during the idsrv3 startup. You will also need the IdentityServer3.MembershipReboot project, which acts as a go-between between IdentityServer3 and MembershipReboot.
In the visual studio package manager console you add the projects like so:
Install-Package BrockAllen.MembershipReboot
Install-Package IdentityServer3.MembershipReboot
You can use the idsrv3 samples as an example of how to set up your classes. https://github.com/IdentityServer/IdentityServer3.Samples
That will give you the data entities you need. Then to write your entities to a database, add the MembershipReboot.EF project and set up a database connection string that gets passed to your override of the MembershipRebootDbContext() class.
Install-Package BrockAllen.MembershipReboot.Ef
The first time you start your identity server, MembershipReboot.EF will use Entity Framework to automatically create your database schema and start writing your entities there.
Hope that gets you started, sorry if it's not what you're asking!
I want to create a database on server startup with certain properties. I have the following in my server.properties file:
server.database.0=file:db;check_props=true;sql.enforce_names=true;sql.pad_spaces=false;hsqldb.default_table_type=cached;hsqldb.tx=locks;hsqldb.tx_level=serializable;hsqldb.write_delay=false
server.dbname.0=ssi
I don't see these reflected in the resulting db.properties file. How should I do this?
These properties are for HSQLDB 2.2.9. The properties file for version 2.x does not contain such properties. The .script file contains the equivalent SQL setting statements.
Most URL properties, including those you have used, do not apply to an existing database.
There is also an issue check_props=true, which wrongly flags the sql.pad_space property.
Does a framework exists that will auto generate (runtime or designtime) a simple CRUDE GUI from my nhibernate mappings and domain? Open source and in c#
MVC Scaffolding package is for Entity Framework, but the T4 templates are editable. You might be able to modify them to use an NHibernate session instead of the EF DBContext. Everything else generated should work pretty well.
Is it possible to specify (or override) the Deploy ApplicationName, database server, and database name for BizTalk projects? If so, how?
Unfortunately this data is stored in the btproj.user file instead of the .btproj file, and my client doesn't want to check the btproj.user files into the source control system.
(FYI - we are using BizTalk Build Generator from CodePlex.)
I've just reviewed the source on CodePlex. When I understood everything correctly they are generating
%AppName%.Custom.targets
%AppName%.Custom.properties
files. Within the properties file some properties are listed for BTS Database Connectivity
<BizTalkDatabaseServerName>.</BizTalkDatabaseServerName>
<BizTalkManagementDatabaseName>BizTalkMgmtDB</BizTalkManagementDatabaseName>
<BizTalkManagementDatabaseConnectionString>
server=$(BizTalkDatabaseServerName);
database=$(BizTalkManagementDatabaseName);
integrated security=sspi;
</BizTalkManagementDatabaseConnectionString>
<PipelineComponentsFolderPath>C:\Program Files\Microsoft BizTalk Server 2010\Pipeline Components</PipelineComponentsFolderPath>
You could easily override these Property values by using the commandline or by adding additional msbuild arguments in VS or TeamBuild using the Property switch
msbuild.exe MyBizTalkProject.proj /p:BizTalkDatabaseServerName=SqlCluster
The developer of this project should rewrite the default MSBuild.Custom.properties file to look like this
<BizTalkDatabaseServerName Condition="'$(BizTalkDatabaseServerName)'==''">.</BizTalkDatabaseServerName>
By using this approach the "." identifier (for local SQL Server) will only be used when no value for the parameter is given. Because with the current implementation the definition of the Property could! override you value passed from the command line. So be aware of that.
Just a basic question. Learning Linq to SQL and some nHibernate. I am using the mvc tutorial and they drag and drop tables onto the visual studio designer to create the classes and wire up everything.
When I experimented with nHibernate I had to do lots with xml files. Does nHibernate have anything that is "easy" like Linq to SQL or is this drag and drop for Linq to SQL so basic that when I want to do something "real" it won't matter that Visual Studio does this for me (at this basic level)? In other words, the further I go with Linq to SQL, I'll eventually have to handle config files like I do with nHibernate.
Look at Castle's ActiveRecord framework. It replaces the use of XML config files with the use of Attributes directly on the class/property declaration. Also, a tool called ActiveWriter integrates with Visual Studio and allows connecting to a data source and generating the object model!
There is no "native" support like you see with LINQ to SQL. However, there are third party add-ins that will allow you to do something similar with nHibernate. My favorite is this one:
http://sourceforge.net/projects/nhibernateaddin
To use it:
Create a data connection to a
database that contains the structure
you are going to code against (your
development database).
Add a new NHibernate plug-in item
(via add new item) to your project
that will contain you domain objects.
In the property window add the data
connection string from the data
connection you just created (this
isn't automated yet).
Finally, you drag and drop your tables
from your data connection to the
NHibernate plug-in object and when
saved your mapping files and you
domain objects are generated. To use
it you create a data connection to a
database that contains the structure
you are going to code against (your
development database).