Could anyone please describe how to use NHibernate Query Analyzer? I downloaded it and trying to build it but it fails, I am not quite sure how to use it.
I am using nHibernate with Sybase and WCF.
Any help is greatly appreciated.
Thanks
Setup NHibernate Query Analyzer (NHQA) Project
After downloading the tool, run Ayende.NHibernateQueryAnalyzer.exe and then:
File -> New -> Project
Click 'Add File(s)...' button and add the following files:
your NHibernate configuration file (i.e. *.cfg.xml, *.exe.config, or *.web.config file)
your assembly DLL (or DLLs) that contain the NHibernate mapped classes and also have the mapping file(s) as an embedded resource
your mapping files only if they have not been added as embedded resources to the DLLs in # 2
(note: in older versions of NHQA, it was necessary to copy the DLLs including its dependencies to the same directory as the NHibernateQueryAnalyzer.exe but that is no longer the case)
Click 'Build Project' button
If receive errors, then something needs to be fixed in either the configuration file, the mapping file(s), the classes in the DLL(s), or all of them. It is important to note the exception messages to help troubleshoot and identify which of the above is source of the problem.
Run Queries
After successfully building the NHQA project, you can create queries:
File -> New -> Query
Now, type in HQL statements. Entities' names and properties can be dragged and dropped from the tree view on the left to your HQL statements on the right. As you type, it provides on-the-fly checking and validation of your HQL statements in the 'Exceptions' tab and displays the auto generated SQL statements in the 'SQL' tab. A sidebar GUI is also available for dynamically defining named parameters.
Hit F5 to execute the query. If it executes successfully, you can view the results in tabular form in the 'DataBase Results' tab or as objects in the 'Object Graph' tab.
Configure Files
New Mapping files can be created by:
New -> Mapping (hbm.xml)
or existing ones can be edited directly:
Open -> Open Mapping...
Same for Configuration files:
New -> Configuration (cfg.xml)
Open -> Open Configuration...
References
Documentation on setup and usage tutorial for NHibernate Query Analyzer is quite sparse but hopefully the above helps.
Related
Can anyone help me please? Right now i'm connecting my web API project to an existing database. Someone suggested to use EntityFramework for that. I'm applying code first approach in the "Entity Data Model Wizard", but the problem is i'm actually supposed to just import tables, but in the "Choose your database Objects and Settings" part, i accidentally imported views as well. so i was thinking to undo the import.
I read that after the Code First wizard, an app.config file should be added to the project, but this file is missing. The .edmx file is also not found. I've searched all files in folders but still not found. But when i looked at the ConnectionString tag in the web.config file, the new connection that i created in the wizard is there.
Please follow below steps to update the EDMX from database again:
Open the EDMX file
2. Right Click on the EDMX file and choose the "Update Model from Database"
3. In the new wizard go to the "Delete" tab and expand the Views
4. Check the Views you want to undo
5. Click on "Finish"
Hope this helps you.
First, a couple of remarks:
I'm applying code first approach in the "Entity Data Model Wizard"
Code First means that there is no .edmx file. There are migration files and code mappings.
I read that after the Code First wizard, an app.config file should be
added to the project, but this file is missing
Not 100% sure here, but I guess that if your project already has a web.config file it will be used instead of adding a new app.config file (they are basically the same).
So, the thing is that you have to enable and use code migrations, you have to generate POCO classes for your entities (if you don't have them already), and you have to add a database context that extends DbContext and includes DbSets for your entities, and some database initialization code.
This page explains how to do the most difficult part of all of that: dealing with the code migrations. Although it assumes that you are migrating from an existing edmx model and using Power Tools you can just ignore that part and focus on the useful information about the migrations. That is, skip directly to Step 2 in the page.
About removing the views you imported, I guess you didn't get to the part where you generate the migrations, so probably you just have to delete the POCO classes created for the views, and possibly also remove the DbSets added to your DbContext for those entities.
If you generated some migration you can either generate a new migration or modify the existing one. This can be done by adding explicit Ignore mappings for your view entities and running Add-Migration again. If you didn't get to the migrations part yet just ignore this last paragraph.
Hope it helps.
I can't seem to figure out how to export a data source configuration in DataGrip (currently on 2016.2 EAP).
I would like to export a handful of data sources and share them with my teammates to make it easier for them to get up and running on DG.
I've tried File->Export Settings (exporting all settings) and did not notice the data source configurations within the resulting jar file.
I seem to recall that in earlier versions of the tool (when it was still called 0xDBE), you could find data source configuration files on the drive and share them that way, but I am unable to locate any at this time.
Perhaps it's not possible?
UPDATE FROM 2021!
Starting from version 2021.1, you can just press Ctrl/Cmd+C on the data source, and then Ctrl/Cmd+V it in another IDE. The clipboard contains XML for the data source, so you can send it to the colleague via e-mail, messenger etc.
It is possible!
You need to share a project with your friend — all you do in DataGrip is in the context of a project. If you did not create a new one, everything is under the default project. Look at the gif:
The more detailed information can be found in the tutorial: https://blog.jetbrains.com/datagrip/2018/05/21/copy-and-share-data-sources-in-datagrip/
You can do it easily via the clipboard, although it took me a while to figure it out:
in your source project, open the Database tool window, select the data sources you want to export, then right click / "Database Tools..." / "Copy Settings"
in your target project, open Database tool window, click on "+" then "Import from Clipboard"
Also works between DataGrip and IntelliJ.
Addendum
The wording has changed slightly in DataGrip 2018.2 EAP (or before), instead of "Copy Settings" it's now "Copy Data Source(s) to Clipboard", which reflects better what it does.
DataGrip stores data sources on two different levels:
Project level: together with project configuration files inside .idea subfolder of the project folder
IDE level: stored in IDE config/options directory.
Project level data source is available once you open the project.
To import/export IDE level Data Source use File | Import/Export settings action.
To move Data Source to IDE settings and back use corresponding action in Datasource Properties dialog (see screenshot) as shown here:
On my current version 2020.1 the projects are on:
/System/Volumes/Data/Users/<USER_NAME>/Library/Application Support/JetBrains/DataGrip2020.1/projects/default/
A good way to find where is it store is just calling:
find . -name "dataSources.xml"
It will find for that file everywhere.
make the data source global and use export settings to export.
https://www.jetbrains.com/help/datagrip/managing-data-sources.html#sharing-data-source-settings
You can find all data sources at this path (change username and version):
C:\Users\fouad.DataGrip2019.1\config\projects\default\.idea
I recently discovered a really cool Mongodb plugin for IntelliJ and DataGrip called 'Mongo Expert' that helps users navigate the Mongodb database and work more efficiently. With support for Commandline MongDB Database Tools like mongoexpert, mongoimport, mongodump, and mongorestore, users can create and execute commands through easy-to-understand dialogues. You can download 'Mongo Expert' from the JetBrains Plugin Repository. I hope it will be useful for you too!
https://plugins.jetbrains.com/plugin/20761-mongo-expert
I am creating a custom process template in our TFS server.
I would like to execute the following line of during the process, to automatically modify the assembly's revision number in AssemblyInfo.cs based on the current MMDD:
File.WriteAllText(file, Regex.Replace(File.ReadAllText(file), "(?<=\[assembly: AssemblyFileVersion\(""[0-9]*.[0-9]*.[0-9]*.)[0-9]*(?=""\)\])", Function(m) DateTime.Now.ToString("MMdd")))
Unfortunately I cannot find out how to execute an arbitrary line of VB.NET code in the build process. There are no code activities called "execute", "run" etc.
I tried to hack it by inserting a lambda function into a WriteBuildMessage() call, but found that lambdas are disallowed:
(EDIT: after other problems with that expression were fixed, it now simply gives the error: "Statement lambdas cannot be converted to expression trees" - ergo I can't do what I'm trying to do here. If "File.WriteAllLines" was string instead of void then I could return it and be laughing.)
Is there a way I can execute an arbitrary line of VB.NET code as part of the build process?
Note: I got around it by adding a node to InvokeMethod directly on System.IO.File.WriteAllText, passing the Regex.Replace call as one of the parameters.
I'll leave the question open in case anyone can provide a direct answer to the original question.
As you mentioned yourself it is possible to use the "InvokeMethod" in order to somewhat execute a line of code.
What I would suggest is to create a custom activity where you can provide it with the parameters, such as the file name and file path.
In order to achieve this two main tasks are needed:
Include a custom build process template
Creating a custom activity
You either do this in your current solution or you create a whole new solution to handle your custom activities and process template.
Include Custom Build Process Template
Whether you choose to work on your current solution or a new one, it is important to have the Process Build Template included in a separate project.
The project needs to be an "Activity Library" which is found under installed (VS 2013):
Right-click solution -> Add.. -> New Project... -> Visual C# -> Workflow
In this project you add your process template that you have been working on, by adding it as an existing item and making it a link. This can be done by pressing the small arrow at the "add" button
When this is included you will need to include several references, which can be found here [1]
Creating Custom Activities
As for the Build Process Template all the custom activities needs a project to be build in. This is to ensure that when they are to be used it is simply referencing the project or including the dll.
This project also needs to be an Activity Library, where this time the activities are to be created.
An activity is a Code Activity and can be created by:
Right-click Project -> Add -> New Item... -> Visual C# Items -> Workflow -> Code Activity
And again this project needs several references in order to build, which can be found here[1]
References:
For more information and ideas take a look at this:
[1]: Ewald Hofman - Customize Team Build
You should not create this yourself. You should use the precreate TfsVersion activity built into the TFS Community Build Tools.
https://tfsbuildextensions.codeplex.com/wikipage?title=How%20to%20integrate%20the%20TfsVersion%20build%20activity&referringTitle=Documentation
This tool will do all of the heavy lifting and is supported by the Visual Studio ALM Ranger and MVP's.
I have have a solution that I created with the new modeler tools. This gave me
two full "endpoints" in a single solution.
Now when I run them through my automated build, I have two dlls in the same
folder that implement IConfigureThisEndpoint.
If I just run NServiceBus.Host.exe \install (to get a Windows Service), it gives
me the (expected) error that there is more than one class that can be used.
I did some searching and Udi states here:
http://tech.groups.yahoo.com/group/nservicebus/message/3937 that "You can
specify which class you want loaded and avoid these issues - as the server
project in the pub/sub sample shows".
I looked at the pub/sub sample and I can't see how I can specify my class (at
least not at the command line).
Is there a way to get around having to modify my build to put the files in
separate folders? (Not really an easy task for me.)
Add a config entry to your app settings with the key EndpointConfigurationType and the value being the assembly qualified name of the type.
When developing sites using Dreamweaver, it creates a _mmServerScripts directory on the root of your site. We've been reading that this folder contains SQL statements that are vulnerable to attack. We would like to avoid this all together, if possible. Is this folder even necessary? Can you do anything to Dreamweaver to tell it to never create these folders?
Thanks in advance.
When you're creating dynamic pages with Dreamweaver, it creates files in the _mmServerScripts folder. Those files are used to obtain information about your database, such as table names, table columns, and column types. This information is used within the built-in server behaviors (and possibly third-party extensions) in order to generate the appropriate code to insert into your page. One such server behavior would be the Recordset server behavior. This interface allows you to select a data source, table name, and column names to include in the recordset.
If you do not use any of the dynamic data functions within Dreamweaver, it probably does not create the _mmServerScripts folder, but if you use that functionality, it will create that folder. If you want to remove the files in this folder, which is hidden within the Dreamweaver Files panel by default (show hidden files: Files panel option menu on the upper right of the panel, View -> Show Hidden Files) by selecting:
Site -> Advanced -> Remove Connection Scripts
I do not have a very extensive knowledge of the contents of the files, so I can't comment knowledgeably about what, if any, vulnerabilities exist within the files within the folder, but it would be good to include links to such discussions you've been reading about.