fluent nhibernate + how to create sql schema - mysql

I have a question about how to render the sql schema with fluent nhibernate.
I have searched alot and used a couple of things but i dont know how to render it. I´m only building the ground of my website, the core. And now i want to create the database from my mappings. How do i do that? Is it with testrunning or what?
If i build the solution i don´t get any sql file i have also tried export it to hbm files to use schema tool export but dont get it to work.
have tried
Fluent NHibernate (1.2.0.712) export mappings to HBM not working / not respecting conventions
and
https://stackoverflow.com/questions/5244257/build-schema-with-fluent-nhibernate
and alot other links.
What do i have to do to get the sql file? every site give almost the same code but they don´t tell how to render it. How to execute the process to retrieve the file..
can anyone tell me? i can build it by my self but i want to try this function!
best regards

You can create the database using the SchemaExport.Create method:
// this NHibernate tool takes a configuration (with mapping info)
// and exports a database schema from it
new SchemaExport(config)
.Create(true, true);
If you want to see the generated SQL, you can use the ShowSql method, but this is not required to create the database.
_sessionFactory = Fluently.Configure()
.Database(SQLiteConfiguration.Standard
.UsingFile(SqliteDatabaseFullPath())
// Display generated SQL in Output window
.ShowSql()
)
...
It's been my experience with NHibernate that it's almost always best to start with a working example, so I suggest you get the FirstAutomappedProject sample project that is part of the FNH source. This will give you all the pieces you need.
Probably easiest to download the zip file (button on the upper left) which includes all the FNH source code, and look in the "src" folder for the examples.

Related

How to add manage temparory data in DotnetNuke?

I am beginner in DNN. I am creating a module which provides Login, Dashboard and Add-Update Form. I have data in JSON format. I want to store it temparory while user use the website. Data will be destroy as soon as user will close the website.
Currently I have created a folder in my Solution Explorer of project in Visual Basic and created 3 .json files which stores login_info.json, basic_info.json and auth_info.json. I write json data whenever user login and I make it blank when user logout.
Above method is working fine now but I afraid it will work when I will publish this module.
Also I may have situation where I need to store image some where. I don't know how I will manage.
Can anybody please guide me?
Is this proper way to store data temparory in DNN?
Is there any other better way?
After getting one of reply for Database Suggestion
Is there any table which same as User Meta in DotnetNuke?
You use the ConnectionString that is used by DNN and access the database as you would normally.
DotNetNuke.Common.Utilities.Config.GetConnectionString()
Or you can use the Data Access Layer that the DNN Framework supplies. For that take the Christoc Templates. In there is all you need to communicate with the DB.

Set up a Datasource for Tabular Models in SQL Server

I want to go through this tutorial. Unfortunately the author has already set up the datasources
and does not explain how to set them up. First off I installed an separate SSAS Instance in my sql server 2014. Then I tried to add a .mdf file via "Attach" but get the Error "AdventureWorks.detach_log could not be found in the folder". So according to this SO solution I tried this command:
CREATE DATABASE YAFnet ON (FILENAME = N'C:\sql_data\YAFnet.mdf')
FOR ATTACH_REBUILD_LOG;
within my SSAS instance query editor but it looks like the query is not a proper one since it is mdx.
Anyone who can help me to get a datasource (adventureworks dw) for my tabular model so I can follow the tutorial?
I would download the tabular backup from AW samples and recover the .abf file

T-SQL Notification - Use HTML to create Chart/Graph

Is it possible to use xml and html to create a chart or graph to include in an email notification from MSSQL Server?
Has anyone done this before? Any suggestions?
For example: A chart visually representing the amount of receiving hours required in the warehouse for the next couple weeks.
It can be tedious but this method works:
Export the data from T-SQL (probably as a JSON) or directly use the database from .Net application.
Now create a word template with some graphs (Line/Bar/Pie Chart or whatever) and bookmark it with some name 'my_chart'
Now include Microsoft.Office.Interop.Word & Microsoft.Office.Interop.Excel references in your C# project. (Google it & see this also)
Now in your C# project access those Graphs in word file using bookmark name & populate it with Data from database. (See this)
It may take some time but if your requirement is worth it you can do this.
Also you don't need to study C#(it's very similar to Java) for this, just see interop C# syntax as you keep going BUT if you want see C# documentation for any reference.
Refer this tutorial also.

How to run sql query to return data from different joomla components

I am trying to customize the source files of a Joomla component.
Before the Joomla MVC model introduced, I was able to run SQL queries in a component, Kunena 1.0 to select data from another component. e.g Sobi2.
However, after Kunena 1.5 [MVC model] was introduced, I do not know how / where to add the SQL query to select data from Sobi2.
I believe I need to add some codes in the files of the /models/ or /func/ folder. But can someone provide more detailed assistance on how I can achieve this?
The data interaction is done by the model, you will find Kunena models in the model folder.
Querying the SOBI2 databse is the same as before, MVC wouldn't actually affect how you do this.
To get your head around MVC, have a look at:
http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
For examples of how to query the database in your model, look at:
http://docs.joomla.org/How_to_use_the_database_classes_in_your_script
In simple terms, the Controller directs to the appropriate view (view.html.php), this view then interacts with the model, and then directs to a template file (normally located in the view/tmpl folder.
Hope this helps.

Error using Dynamic Data Filtering: missing datasource

I am trying to use the ASP.NET Dynamic Data Filtering project, but I'm running into a problem during the configuration.
I'm following the instructions on the author's blog, and everything works like described. Then it tells me to change the datasource using the designer view. I am told to select the "GridDataSource" in the "Configure data source" wizard. This option is not there though.
I get all of the classes in my project, including the DataContext that was generated by Linq. When I choose "Show only DataContext objects", the dropdown ("Choose your context object:") is completely empty.
When I turn of the checkbox and choose my DataContext class, I get asked which table I want and all that. But, as the whole purpose of a Dynamic Data site is NOT to use one single table, that's not much help.
So I've looked at the instructions again and copied the resulting datasource from the example:
<asp:DynamicLinqDataSource ID="GridDataSource" runat="server"
EnableDelete="True" EnableUpdate="True"></asp:DynamicLinqDataSource>
Which is exactly what I had, without the "WhereParameters" nodes in there.
Now, when I run the list page however, I get an exception about a missing datasource from the filtering component. Of course when I remove the DynamicFilterRepeater, it works again.
This is the meat of the exception:
[InvalidOperationException: Missing DataSource]
Catalyst.Web.DynamicData.DynamicFilterRepeater.GetTable() in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:74
Catalyst.Web.DynamicData.DynamicFilterRepeater.GetFilters() in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:81
Catalyst.Web.DynamicData.DynamicFilterRepeater.OnInit(EventArgs e) in D:\Catalyst\Projects\DynamicData\Project\Trunk\DynamicData\DynamicData\DynamicFilterRepeater.cs:106
How do I make the DynamicFilterRepeater recognize my datasource?
I'm using VS2010 Pro, on a Win7 machine.
have you looked at the sample project you get when you download the source code.
Have a look at my blog post here Dynamic Data Filtering – Installation