Which Visual Studio project types support Shift+Alt+D to open the Data Sources window? - visual-studio-2012

In Visual Studio 2012, it appears that only maybe a third of the 20 or so C# project types support using Shift+Alt+D to open the "Data Sources" window (and none that I've found ever display the mythical "Data" menu bar option).
Is there any sort of guide as to which project types will allow you to work with data sources?
Also, is there any way to "adjust" the features of a project after it's been created?
Update: See my answer below for how to add the Data Sources function to an existing project.

I believe you are looking for this page:
http://msdn.microsoft.com/en-us/library/yft2c9ad.aspx
To quote msdn: "You can add a data source to a project only if it supports creating and working with data sources. For example, you can't open the Data Sources window in a project for a Windows Store app."
Basically, if using a database seems logical in your application, you can probably use one.
To answer your question about the "mythical 'Data' menu bar option", here's how you access it:
You just have to select "View", then "Other Windows", and finally "Data Sources"
And to answer your final question about, "Also, is there any way to 'adjust' the features of a project after it's been created?"
Yes, yes there is. If you mean as a compiled executable, one could simply decompile the project or use an ILcode editor. If you mean as a solution in visual studios, using the solution explorer you can access "My Project" and simply double click that to get a nice little gui for adjusting your project.
EDIT:
For an overload of information about data in visual studios, you can visit: http://msdn.microsoft.com/en-us/library/wzabh8c4.aspx
For more information about just the data source window, you can visit:
http://msdn.microsoft.com/en-us/library/6ckyxa83.aspx

Aha! There is a way to add data access to a project that lacks it, per: http://msdn.microsoft.com/en-us/library/bb907587.aspx. To quote:
To create a class from a database table
If you are working with a Web site project, and the project does not already have an App_Code folder, in Solution Explorer, right-click the project, click Add ASP.NET Folder, and then click App_Code.
In Solution Explorer, right-click the App_Code folder (for a Web site project) or the project (for a Web application project) and then click Add New Item.
Under Installed templates, select Linq to SQL Classes template, type a name for the .dbml file, and then click Add.
-- The Object Relational Designer window is displayed. [Note that this is the window that Shift-Alt-D displays]
In Server Explorer, drag the database tables or other objects (such as views) that you want to use with LINQ to SQL into the Object Relational Designer window.
-- The tables and their columns are represented as a entities in the designer window.
Save the .dbml file.
This creates .designer.cs or .designer.vb file that is located under the .dbml file. The file contains a class that represents the database and a class that represents the table. The parameterless constructor for the database class reads the connection string from the Web.config file.
(Note that, after performing this procedure you may get a message "The type or namespace name 'Linq' does not exist in the namespace 'System.Data'". The solution to this problem is found here.)

Related

Adding a custom t4 template to DDL Generation Template dropdownlist

I know I can add the template in the folder
C:\Program Files (x86)\Microsoft Visual Studio
11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen
to make it visible in the DDL Generation Template dropdownlist, but then I need to distribute the template to my team members so they can add the template to the same folder.
I was hoping that I could achieve the same result by adding the template to the VS 2012 solution somehow and make it visible in the same dropdownlist
Do you know a way to achieve this?
I'm using VS 2012 and to generate the database I use Model First approach
I played around with this tonight and found it is possible, but it's kind of a hack. You'll have to edit your edmx file by hand, and make sure it is version controlled because you have to edit the designer section of the edmx file (auto-generated). First thing is to copy the t4 template to the root of your project (might actually have to be in the same folder as the edmx, not sure). Then add the t4 template to your project. Now remove the custom tool entry (in properties) so it doesn't try and auto gen the t4 template. finally add the designer property below in the correct location in the edmx file (i included context to find the right place):
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
<edmx:Options>
<DesignerInfoPropertySet>
<DesignerProperty Name="DDLGenerationTemplate" Value="SSDLToSQLite3.tt" />
I ended up making a custom template to generate datetime2 fields. Although I could not get the template to show in the drop down in the properties box, I was able to add the template to the same folder as my .edmx, include it in the solution, then type the file name of the template directly into the designer's property field replacing the default. The value appears to be retained after generating databases and entities, I didn't need to directly edit the edmx XML, and my custom template is now source controlled right next to where it is used.

Exporting DLL description - reference with Visual Studio 2012

I colleague of mine asked me to see a dll that he needs to use. So I used the Object Browser on Visual Studio 2012. Now he asked me if I can export like a text version of the dll reference (methods signatures and properties).
Is there a way to do it?
I can already see something like
short get_Param(short sNumParam)
Member of LMLib.ISWKey
on the windows dedicated to the description. I just need to put every method in a single file.
You can do it with a trick and have the IDE generate the definitions for you. Write a sliver of code in the text editor, similar to:
var obj = new LMLib.ISWKey();
Right-click ISWKey in the text editor and select "Go To Definition". You'll get a new text file with the definitions, auto-generated from the metadata.
If it is a COM interface, sure sounds like it with a name like that, then you can run Oleview.exe from the Visual Studio Command Prompt. Use File + View Typelib, select the type library of the COM server and you'll get the auto-generated IDL for the server. Prefer this approach if it is in fact a COM server, you'll get more info, including the [helpstring] attributes.
And of course, don't hesitate to ask the owner of the DLL for documentation. You paid good money for the license to use the DLL.

Change SharePoint Library URL

How do you change the URI of a SharePoint library? Based on Google searching, most people say that changing the name of a library in Designer (via right click->rename) will result in the URI change, but it is only changing the name for me.
I am using SharePoint 2010 Foundation and these are the steps I am following:
In Designer, navigate to List and Libraries
Right click library -> rename
Notice that name changes
Notice that URI does not change
This is one of the resources I found claiming that this works:
change URL spelling/case on sharepoint library
In SharePoint Designer just navigate to All Files navigation node (not List and Libraries node), find your document library there -> right-click library -> rename.
The URI would change then.
Edit:
At least at SharePoint 2010 it is possible to change library URL, without using SharePoint Designer.
Just go to a library trough 'All Site Content'. When inside the library choose on the ribbon 'Library' tab. Then select 'Open with Explorer'. That will open your SharePoint's library in Windows Explorer window. Navigate one folder up and you will see list of your libraries as folders. Rename required library's folder name as you want the URL to look like.
SOLUTION:
Thank you! I found the suggested SharePoint Designer solution above to work beautifully!
Here are the steps that I took:
Follow the instructions above by opening the List in SharePoint Designer, selecting All Files under the navigation node (near the bottom)
A bunch of folders appeared - I selected the folder named 'Lists'.
From here, it will show the list names and the display names. Change the actual name of the list (first column) by right-clicking on it, rename. This will update the url. You may wish to match this to your display name.
When you return to your site, the navigation link for the list may still go to the old URL. To update this, enter in the new url in your browser, go to List Settings > Title, Description and Navigation. Simply hit the save button without making any changes. The navigation link is now updated.
Please note: If you are updating list urls and names of a project site (from Project Server), do not rename the Risks, Issues lists. These must remain for Project Server to function properly.
Thanks for this solution. I only have Designer permissions but was still able to change a List URL within the browser (not Sharepoint Designer, and must be IE to have Open in Explorer enabled). Steps:
Go to Site Contents and open a Document Library in the site
Click on Library ribbon tab and select Open In Explorer option
Click up one level in the directory structure - there should be a
Dir called 'Lists' - open
Your List should be there to right click and rename.
I was surprised that the system let me do this (it didn't let me delete a document in the same DL that I need to get rid of), but after testing for some time the URL change seems to have held.
Finally - you might have to re-Resolve some views and overlays, as these might not automatically cascade with the new List location.
Cheers,
Ross
I have changed the library URL from SharePoint Designer 2010, in the "Site Object" section --> "All files" option. Then I selected the right library in left pane and press F2 (to change name, like in windows) and worked for me. I hope that helps someone.
You cannot change Document Library URL , only name.
If you want to have a new URL :
Create a new document library with good URL
Batch import all docs from old to new document library
warning :
all new imported doc will be flagged with username used in the import process
all datetime fields will be reinitialized
I don't have Sharepoint Developper installed and can't install it.
I needed to change the address of a List and not a library, so the "Open in Explorer" doesn't work for me (only get "Open in Access" and "Open in Project").
I managed to do it by opening Explorer by myself and paste the URL "http://MyServer/MySite/" (can be also "http://MyServer/MySite/MyPage/").
I got the "All Files" you get through Sharepoint Designer.
In my case I had to go to "Lists" and change the name of the folder for the list I wanted to change the name.
Next I had to change the name of the list from the "List properties" (to change back the visible name of the list)
I am only a Site Collection Administrator for a SharePoint online platform. The powershell and sharepoint designer usage are not within my access so the only option I have is the "Open in Explorer". I tried the steps seen online but didn't get the result. When I saw ragmaxone's step, I got an idea. Then I took the following steps:
I copied my url without the document library eg "http://MyServer/MySite/MyDocLib/ is the URL of the document library but I copied "http://MyServer/MySite/ instead.
Next I opened the document library in classic SPOnline because I use modern SPonline.
Then I replaced the pathway address with the copied URL and saw all my document libraries as folders.
With right clicking on the document library of interest, and renaming like is done in windows, I went back to my document library and saw page not found.(Don't worry! Something had changed already).
Then I went to the homepage of the platformand navigated to the document library in question to see that it has been renamed and the URL also corresponds to the new name.
Thanks for all your answers and help.
In Designer go to "All Files" -> then search for "List" folder ther you can find your List right click it rename it and boom.
By going to Lists and Libraries tab from left menu will only change the title of list. So go to All files and follow the steps.

Visual Studio 2012 SSDT - How do I create/manage tables now?

I'm trying out Visual Studio 2012 and so far it's good but I created database project, added database *.mdf file to my App_Data and tried to create simple database with relations and I have no clue what to do next. I can't even name my database.
http://msdn.microsoft.com/en-us/library/hh272680(v=vs.103).aspx - AFAIK this article shows how to add relations but I can't find any Foreign Keys node. And also, why can't I edit name? VS2010 database management was so easy and intuitive, now I don't understand how to work with it.
More visual representation of my question and my simple table for example.
Table name you can change in Properties window:
relations by right clicking on Foreign Keys:
You can also modify sql in lower pane - all changes will be reflected in graphical tools. I'm find this useful e.g. when I want to copy some columns from one table to another.
You can also make changes on database with another tools, like SSMS (better FK tools I think) and then import this changes via Schema Compare by setting database as source and project as destination.
Right click on the database where you like to execute the query and then select add new query and execute the following query in it.
sp_rename 'oldtablename','newtablename'
Not so far. Right clic on this element.
check out this answer: Visual Studio 2012 Database Designer - Has the functionality changed?
I'm new to sql anyway if you right click the toolbar there is a "table designer" set of buttons but are all grayed out. Not sure if to initiate them the db must be Online.

SharePoint Designer 2007 - link to a Document Library on a site from another site?

I am trying to create a link to an existing Shared Documents folder on another site. Both sites are on the same server.
Here are the steps I take to create a link to an existing Document Library:
I create a document library web page in Share Point 2007.
I open the document library (AllItems.ASPX) in Share Point Designer.
I delete the existing web part for the list.
In the Data Source Library, I click on "connect to another library" and create a connection to the other site.
I select the document library, click show data, select my rows and click Insert Multiple Item View.
I then configure the look for each field (hyperlinks, etc).
I edit the Filter for this view to show only the files that are for this location.
I click on Data View Properties and select "Enable sorting and filtering on columns (basic table layout only).
Basically I am trying to have a central location for all files for a site and sub sites. I want the sub sites to see the documents for their own location, be able to search through the files, etc.
The problems I am having are:
I am unable to open the links in a new window, even when I set the hyperlink to do so. I would prefer the file be opened in its native application (ie. A Word doc open in Word).
I am unable to show the file icon in the same way it shows up in the original document library.
When I go to the header and click ANY field, I can sort the field ascending or descending but I always get a message stating "This column type cannot be filtered".
Is there an easier way to do this? Or can someone tell me what I am doing wrong? I am new to using Share Point. Thanks for the help!
Some help for problem 1 (unable to open the links in a new window)...
I'm not sure if this will work using the Data View Web Part you have configured. However there is a technique for the List View Web Part. If you add a boolean field called OpenInNewWindow to your document library then documents that have this set to Yes will open in a new window. Try this out - it may work.
If you need to open PDF files in a new window, beware that there is an ActiveX control that will get in the way. Read this question for more information.

Resources