Posts Tagged ‘ Visual Studio ’

Using BCS from Visual Studio 2010 for deployment to SharePoint Foundation 2010

Business ConnectivITy Services is the new version of the SharePoint 2007 technology called Business Data Catalog. The base of this technology is now available in SharePoint Foundation 2010 which is the free version of SharePoint. This means you can build an External Content Type in Visual Studio 2010 and deploy IT to SharePoint Foundation 2010 and the code in the External Content Type retrieves the data which is then shown in a standard SharePoint list.

Great technology. I wanted to link to the trick to making the External Content Type deploy from Visual Studio 2010 to SharePoint Foundation 2010 which doesn’t affect SharePoint Server 2010.

  • Share/Bookmark

***FREE*** Visual Studio 2010 Launch Event – Jacksonville, FL May 11

JAXDUG, my local developer User Group,  is putting on local Visual Studio 2010 Launch event for free on May 11 from 9a-3p. The event, hosted at the 5 Points Movie Theater, will be presented by the communITy on a few areas of Visual Studio 2010. Topics include:

  • Opening the Tacklebox on Visual Studio 2010 – by Joe Healy (MSFT)
  • Silverlight & Windows Phone 7 Development wITh Visual Studio 2010 – by Henry Lee
  • Simplifying Deployments wITh MSDeploy and Visual Studio 2010 – by Sayed Hashimi
  • Introduction to Functional Programming wITh F# in Visual Studio 2010 – by Eugene Chuvyrov

I’ll be doing a session on the new tools included in the base install of Visual Studio 2010 for SharePoint developers:

  • Improvements to the SharePoint Developer Story wITh Visual Studio 2010
    Microsoft has invested a considerable amount of effort in improving the developer story for SharePoint Server 2010 wITh the latest release of Visual Studio 2010. In this session we’ll explore the new tools available to developers as well as how you can customize them for your own experience.

For more information about this event, check the JAXDUG sITe:

» JAXDUG: Visual Studio 2010 Launch

  • Share/Bookmark

Visual Studio 2010: Not Just Good for Developers

A New Date for Visual Studio 2010So IT’s April 12 and IT is official — Microsoft has announced the availabilITy of Visual Studio 2010 (news, sITe) and Microsoft .NET Framework 4.0. IT’s an excITing time for developers. But what if you are not a developer? Well, there’s something there for you to be excITed about too.

Read full story…

<a href="http://bIT.ly/Ts8lh”><img src="http://images.cmswire.com/images/ico_twITter-newsy_40×40.jpg” alt=”" align=”bottom” border=”0″ width=”40″ height=”40″ />
<a href="http://bIT.ly/Ts8lh”>Follow us on TwITter

Join free newsletter

View upcoming events

Find a new job

  • Share/Bookmark

Walkthrough of enabling CRUD for SharePoint 2010 external lists using Visual Studio 2010

In our last blog of this series Walkthrough of creating a SharePoint 2010 external list using Visual Studio 2010 Beta, we introduced how to create a simple “Hello world” external list in SharePoint 2010 Beta using Business Data Connectivity Designer in Visual Studio 2010 Beta.

In this blog, we will show you how to pull data from an external database into an external list and enable Create, Read, Update and Delete (CRUD) functions to the external list.

First of all, you need to have SharePoint 2010 Public Beta and Visual Studio 2010 installed on your machine in order to complete this walkthrough. We’ll use “Northwind” database as external data source, so if you do not have an existing “Northwind” database available, we’ll walk you through to create a local database using SQL Server Express first (SQL Server Express comes with Visual Studio installation by default, in case you don’t yet have it, download it here).

At the end of this post, we will complete with a BDC model project which has a “Customer” entity connects to “Customer” table in “Northwind” database, and have CRUD operations enabled. The finished project can also be downloaded from here.

Prepare the data source

If you already have a “Northwind” database, you can skip this section. Otherwise, please download SharePoint2010_BDCSamples.zip from here and extract the SQL script file CreateSampleNorthwindDB.sql.

Open Visual Studio. Go to View->Server Explorer. Right click Data Connections in Server Explorer, and select Create New SQL Server Database.

1. In the prompt dialog, type “localhost\sqlexpress” in Server Name text box, and give the new database name “SampleNorthwind”.

* If you’re using the SQL Express that comes with SharePoint Server, please replace “localhost\sqlexpress" with "localhost\sharepoint”.

2. Start a Command Prompt. Go to Start->Run, type “Cmd” in the text box and click OK.

3. In the Command Prompt, type in following command and press enter:

sqlcmd -S localhost\sqlexpress -d samplenorthwind -i <Path of CreateSampleNorthwindDB.sql file>

Create BDC Project

Create a new C# BDC Model project and rename it “BdcSampleCSharp”. VB code snippets will also be provided, so you can create VB BDC Model project if you want. In this walkthrough, we will use C# project as an example. (Check this blog for how to create a BDC project)

Connect to external data source

To use the SampleNorthWind database, we add a LINQ to SQL model to the project:

1. On the Project menu, click Add New Item, in the prompt Add New Item dialog select Data in the Installed Templates pane, in the Templates pane select LINQ to SQL Classes, in the Name box, type “Customer”, and then click Add.

2. In the Server Explorer, go to Data Connections->[hostname]\sqlexpress.SampleNorthWind.dbo->Tables->Customers, drag the Customers table and drop it on the Customer.dbml design surface.

3. Add a new class file and rename it “CustomerDataContext.cs”. Replace the code of the class with the following code snippet.

Note: We made the connection string a constant in the code only for demo purpose, if you’re using your own database, modify the connection string as needed. In our future post we will introduce how to set the connection string in a custom property on LobSystemInstance inside the BDC model and read the value through IContextProperty interface at runtime.

C#:

public partial class CustomerDataContext
{
    private const string ConnectionString = @"Data Source=localhost\SQLEXPRESS;Initial Catalog=SampleNorthwind;Integrated Security=True;Pooling=False";

    public CustomerDataContext() :
        base(ConnectionString, mappingSource)
    {
        OnCreated();
    }
}

VB:

Partial Public Class CustomerDataContext
    Private Const ConnectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=SampleNorthwind;Integrated Security=True;Pooling=False"
    Public Sub New()
        MyBase.New(ConnectionString, mappingSource)
        OnCreated()
    End Sub
End Class

Design BDC Model

1. On the design surface, delete entity Entity1 which is created by default. On the View menu, click on Toolbox if it is not shown. Create a new entity by drag and drop the Entity icon from Toolbox onto design surface (see the screenshot below). In the Properties Browser, change the value of Entity’s Name property to “Customer”.

Create a Specific Finder method for the entity. To do so, on the design surface, select entity Customer, you could find a <Add a Method> command in the Method Details Window. If the Method Details Window is not opened, you can find it in menu View->Other Windows->BDC Method Details. From the <Add a Method> drop-down list, select Create Specific Finder Method:

TypeDescriptors for the return parameter Customer. The edit need to be done in BDC Explorer. You can find it by going to View->Other Windows->BDC Explorer.

a) In the Method Details Window, click <Edit> command in the drop down control from TypeDescriptor Customer as depicted below. After the click the BDC Explorer will get focused on the TypeDescriptor Customer.

LINQ to SQL model. In this example, all the TypeDesriptors have a type of System.String which is the default one so we do not need to change them. After this step, we get the following TypeDescriptors in BDC Explorer:

this blog to see how to create an external list). After the list is created, you will see the following page appears when you click on the list name:

Walkthrough of creating a SharePoint 2010 external list using Visual Studio 2010 Beta, we introduced how to create a simple “Hello world” external list in SharePoint 2010 Beta using Business Data Connectivity Designer in Visual Studio 2010 Beta.

In this blog, we will show you how to pull data from an external database into an external list and enable Create, Read, Update and Delete (CRUD) functions to the external list.

First of all, you need to have SharePoint 2010 Public Beta and Visual Studio 2010 installed on your machine in order to complete this walkthrough. We’ll use “Northwind” database as external data source, so if you do not have an existing “Northwind” database available, we’ll walk you through to create a local database using SQL Server Express first (SQL Server Express comes with Visual Studio installation by default, in case you don’t yet have it, download it here).

At the end of this post, we will complete with a BDC model project which has a “Customer” entity connects to “Customer” table in “Northwind” database, and have CRUD operations enabled. The finished project can also be downloaded from here.

Prepare the data source

If you already have a “Northwind” database, you can skip this section. Otherwise, please download SharePoint2010_BDCSamples.zip from here and extract the SQL script file CreateSampleNorthwindDB.sql.

Open Visual Studio. Go to View->Server Explorer. Right click Data Connections in Server Explorer, and select Create New SQL Server Database.

1. In the prompt dialog, type “localhost\sqlexpress” in Server Name text box, and give the new database name “SampleNorthwind”.

* If you’re using the SQL Express that comes with SharePoint Server, please replace “localhost\sqlexpress" with "localhost\sharepoint”.

2. Start a Command Prompt. Go to Start->Run, type “Cmd” in the text box and click OK.

3. In the Command Prompt, type in following command and press enter:

sqlcmd -S localhost\sqlexpress -d samplenorthwind -i <Path of CreateSampleNorthwindDB.sql file>

Create BDC Project

Create a new C# BDC Model project and rename it “BdcSampleCSharp”. VB code snippets will also be provided, so you can create VB BDC Model project if you want. In this walkthrough, we will use C# project as an example. (Check this blog for how to create a BDC project)

Connect to external data source

To use the SampleNorthWind database, we add a LINQ to SQL model to the project:

1. On the Project menu, click Add New Item, in the prompt Add New Item dialog select Data in the Installed Templates pane, in the Templates pane select LINQ to SQL Classes, in the Name box, type “Customer”, and then click Add.

2. In the Server Explorer, go to Data Connections->[hostname]\sqlexpress.SampleNorthWind.dbo->Tables->Customers, drag the Customers table and drop it on the Customer.dbml design surface.

3. Add a new class file and rename it “CustomerDataContext.cs”. Replace the code of the class with the following code snippet.

Note: We made the connection string a constant in the code only for demo purpose, if you’re using your own database, modify the connection string as needed. In our future post we will introduce how to set the connection string in a custom property on LobSystemInstance inside the BDC model and read the value through IContextProperty interface at runtime.

C#:

public partial class CustomerDataContext
{
    private const string ConnectionString = @"Data Source=localhost\SQLEXPRESS;Initial Catalog=SampleNorthwind;Integrated Security=True;Pooling=False";

    public CustomerDataContext() :
        base(ConnectionString, mappingSource)
    {
        OnCreated();
    }
}

VB:

Partial Public Class CustomerDataContext
    Private Const ConnectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=SampleNorthwind;Integrated Security=True;Pooling=False"
    Public Sub New()
        MyBase.New(ConnectionString, mappingSource)
        OnCreated()
    End Sub
End Class

Design BDC Model

1. On the design surface, delete entity Entity1 which is created by default. On the View menu, click on Toolbox if it is not shown. Create a new entity by drag and drop the Entity icon from Toolbox onto design surface (see the screenshot below). In the Properties Browser, change the value of Entity’s Name property to “Customer”.

Create a Specific Finder method for the entity. To do so, on the design surface, select entity Customer, you could find a <Add a Method> command in the Method Details Window. If the Method Details Window is not opened, you can find it in menu View->Other Windows->BDC Method Details. From the <Add a Method> drop-down list, select Create Specific Finder Method:

TypeDescriptors for the return parameter Customer. The edit need to be done in BDC Explorer. You can find it by going to View->Other Windows->BDC Explorer.

a) In the Method Details Window, click <Edit> command in the drop down control from TypeDescriptor Customer as depicted below. After the click the BDC Explorer will get focused on the TypeDescriptor Customer.

LINQ to SQL model. In this example, all the TypeDesriptors have a type of System.String which is the default one so we do not need to change them. After this step, we get the following TypeDescriptors in BDC Explorer:

this blog to see how to create an external list). After the list is created, you will see the following page appears when you click on the list name:

  • Share/Bookmark

Force Visual Studio 2010 to add a SafeControl Entry

When you create a project in Visual Studio 2010 on one of the SharePoint project templates
it will take care of all the packaging for you.

But when I was working on a project with custom workflow actions, the SafeControl
entry that is needed for making it work
was not added to the generated manifest.xml
file.

Fortunately the package designer allows you to modify the template file it uses for
generating this file. So open up the package designer, switch to the “Manifest” tab
and add the assembly reference in the template yourself, but this time, include the
SafeControl entry:

CodeRush & Refactor extensions I wrote for Visual Studio 2008 for SharePoint developers.

If you aren’t familiar with what I’m talking about, back in 2007 I created a few extensions for those customers who had bought a copy of DevExpress’ CodeRush & Refactor Pro! products. These were aimed to make SharePoint development a bit easier. One was a suite of plugins and templates (which was dependent on a licensed and installed copy of CodeRush), the other was a tool window that only required the free DXCore Visual Studio AddIn.

After working with new SharePoint tools in Visual Studio 2010 for the last year+, I’ve come to the conclusion that my tools are no longer really necessary. The stuff Microsoft gives us OOTB are so robust and extensible using MEF, it’s better to extend them that way than to base off a commercial product. Therefore I’ve decided to not upgrade or port my extensions to Visual Studio 2010.

I still love CodeRush & Refactor Pro… I just don’t plan to upgrade my my tools for the latest release of SharePoint or Visual Studio. I do have some ideas around how to extend Visual Studio for various things… I’ll post those here on my blog.

  • Share/Bookmark

Visual Studio 2010 RC is Available, along with ASP.NET MVC 2 and a new Azure Toolkit

Visual Studio 2010 RC is AvailableVisual Studio 2010 (news, site) is now out as a Release Candidate and available to everyone to try out. Keep in mind it will still have issues and if you want to do Azure or MVC development, there a few things you need to do.

Read full story…

  • Share/Bookmark