Tag Archives: Visual Studio 2010

Using Visual Studio 2010 to Create BCS Applications

There are two ways to use Visual Studio to create BCS applications. The first is to build custom BCS models with the Business Data Connectivity Model, the second is to use Visual Studio to migrate declarative models built with SharePoint Designer for deployment via solution packages.

Business Data Connectivity Model

Visual Studio 2010 includes the Business Data Connectivity Model project template that you can use to create and use a .NET Assembly shim to any data store for use by BCS. Solutions based on the project template consist of a feature to install the model in BCS, an XML configuration file that is the model, and .NET classes that do the work of reading and writing data.

The XML model contains all of the information required to work with the .NET classes including method and type descriptors. This means that the associated .NET class’s methods and parameters must match the model.

At this point in the chapter you may have the strong impression that Microsoft really wants people to buy licenses to SharePoint Server if they need BCS. If so, it will not surprise you to discover that you must do some extra work to use this project template with SharePoint Foundation to support deployment to BCS.

Migrating Declarative Models to Visual Studio

You can use the Business Data Connectivity Model project template as a basis to migrate declarative models created in SharePoint Designer. Begin by using SharePoint Designer to export the model. Then create a Business Data Connectivity Model project and remove the default template items. Finally, add the exported model and replace the missing SharePoint Server specific feature receiver to deploy the model to SharePoint Foundation.

doug (frame 367 of smile clip)This post is an excerpt from the online courseware for our Microsoft SharePoint 2010 for Developers course written by expert Doug Ware.

Doug Ware is a SharePoint expert and an instructor for many of our SharePoint 2007 and SharePoint 2010 courses. A Microsoft MVP several times over, Doug is the leader of the Atlanta .NET User Group, one of the largest user groups in the Southeast U.S., and is a frequent speaker at code camps and other events. In addition to teaching and writing about SharePoint, Doug stays active as a consultant and has helped numerous organizations implement and customize SharePoint.

The WPF Layout System – Visual C#

Layout in WPF is flow-based, but it also includes automatic resizing and repositioning of controls if the user changes screen resolution or resizes the window containing controls or adds or removes controls at runtime. As you will see in this chapter, this provides resolution and size independent user interfaces.

A window can contain one element, or control. That element will almost always be a container. A container contains controls and, optionally, other containers. All container controls derive from the System.Windows.Controls.Panel class. Layout in WPF is a recursive process. The .NET Framework runtime makes two passes before drawing elements.

In the Measure pass, the runtime queries each element to determine the element’s size and location. In the Arrange pass, the runtime determines the actual size and position for each element. Elements may or may not be sized and located where they requested, depending on the number of elements, the screen resolution, the size of the window, etc.

Layout is not only a recursive process, but it is also an iterative process. The entire layout process occurs each time the user resizes the window or your code adds or removes elements. You should keep this in mind as you design user interfaces.

How does the layout system determine how to size each element? Each element on a window is surrounded by a bounding box, as shown in Figure 1. This represents the space allocated to the element, and therefore represents the maximum size of the element.

helloworld

Figure 1 Each element on a window is surrounded by a bounding box.

The layout system determines the actual size of an element by taking into account the following:

  •  The available screen space.
  • The size of any constraints, such as maximum or minimum height or width.
  •  Layout-specific properties, such as alignment, margins, padding, etc.
  •  The behavior of the parent container.

As needed, the layout system can shrink, grow, or move elements on a window.

Alignment, Margins, and Padding

All elements have four properties that are important to understand, as these play a key role in determining the position of elements in a window. These properties are HorizontalAlignment, VerticalAlignment, Margin, and Padding. Alignment refers to how child elements should be positioned within a parent element’s allocated layout space. The HorizontalAlignment property determines how an element is positioned horizontally within a container. The possible values for this property are Left, Right, Center, and Stretch, as shown in Figure 2. If this property is set to Stretch, which is the default, the control will expand to its maximum available width.

WPFLayoutSystem2

 Figure 2  The HorizontalAlignment property determines how an element is positioned horizontally within a container.

The VerticalAlignment property determines how an element is positioned vertically within a container. The possible values for this property are Top, Bottom, Center, and Stretch, as shown in Figure 3. If this property is set to Stretch, which is the default, the control will expand to its maximum available height.

WPFLayoutSystem3

Figure 3. The VerticalAlignment property determines how an element is
positioned vertically within a container.

The Margin property determines the distance between an element and its child or peers. This property consists of four parts: the left margin, the top margin, the right margin, and the bottom margin. The following XAML sets the margin for an element following this pattern:

<Button Margin=”0,10,0,10″…

The previous code specifies that there should be no additional space on the left and right, but there should be a ten pixel space on the top and bottom. If you want the same margin on all four sides, you only need to specify one value. The following XAML sets the margin to ten on all sides:

<Button Margin=”10″…

The Padding property is similar to the Margin property, however it is only available for certain controls, including Border, Button, and TextBlock. The property adds space between the edge of a control and its content.

Figure 4 shows the use of the Margin and Padding properties, along with horizontal alignment, to control the layout of elements.

WPFLayoutSystem4

Figure 4. You can use the Margin and Padding properties, along with horizontal
alignment, to control the layout of elements.

Containers

As mentioned earlier, each window can contain a single element. This element will typically be a container control. This chapter covers the following containers:

  • StackPanel: Stacks elements horizontally or vertically.
  • WrapPanel: Places elements in rows and columns that wrap as needed.
  • DockPanel: Aligns elements along an edge.
  • Grid: Places elements in rows and columns.
  • Canvas: Places elements according to coordinates.

This post is an excerpt from the online courseware Windows Presentation Foundation Using Visual C# 2010 course written by expert Ken Getz and Robert Green.

Ken Getz is a Visual Studio expert with over 25 years of experience as a successful developer and consultant. He is a nationally recognized author and speaker, as well as a featured instructor for LearnNowOnline.

Robert Green is a Visual Studio expert and a featured instructor for several of our Visual Basic and Visual C# courses. He is currently a Technical Evangelist in the Developer Platform and Evangelism (DPE) group at Microsoft. He has also worked for Microsoft on the Developer Tools marketing team and as Community Lead on the Visual Basic team. Robert also has several years of consulting experience focused on developer training, and is a frequent speaker at technology conferences including TechEd, VSLive, VSConnections and Advisor Live.

Review of DataSets

VisualStudio2010ADO.NET provides the ability to retrieve data from any number of data sources and to work with that data in memory. The DataSet object represents a local cache of data that is disconnected from the original source. The DataSet object can provide a relational view of data: It can contain tables, columns, rows, constraints, and relationships. The DataTable object represents one table of in-memory data. It supports rows and columns with schema information, much like an array, but it’s far more powerful. You can retrieve a DataTable by retrieving data from a data source, or you can create and fill the DataTable manually. The DataTable class exposes collections of rows and columns, where a row represents a reference to an actual row of data, and a column contains information about the schema for one of the columns of data. A DataTable’s Rows property contains a collection of DataRow objects, and its Columns property contains a collection of DataColumn objects. You can access and manipulate data in a DataTable’s rows by using a DataRow object. When you work with the Rows property of the DataTable, you can:

  • Access a DataRow object within the Rows collection by index, enumerator, or lookup.
  • Iterate through all rows, using a DataRow object as the iterator.
  • Iterate through all the rows, using an integer as the indexer.
  • Use the NewRow method of the Rows collection to add a new row, which returns a new DataRow object.

DataSets can be untyped or typed. When you directly instantiate the DataSet class, as shown in the following code, you will have an untyped DataSet.

A typed DataSet inherits from the DataSet class. It contains strongly typed properties for each DataTable. This means you can refer to tables and columns by names. If you are using an untyped DataSet, you can refer to the Products table by using myDataSet.Tables(“Products”). You can refer to the ProductID column in the Products table by using myDataSet.Tables(“Products”).Columns(“ProductID”). If you are working with a typed DataSet, you can use myDataSet.Products to refer to the table and myDataSet.Products.ProductID to refer to the column. When you create a data source via the Data Source Configuration Wizard, Visual Studio creates a typed DataSet that includes the tables you specify.

ldn-expertkgetzThis post is an excerpt from the online courseware for our Microsoft LINQ Using Visual C# 2010 course written by expert Ken Getz.

Ken Getz is a Visual Studio expert with over 25 years of experience as a successful developer and consultant. He is a nationally recognized author and speaker, as well as a featured instructor for LearnNowOnline.

When Apps Need to Be Delivered Better, Faster & Cheaper, Visual Studio Can Help

StartLearningButton

Application development is the foundation of any successful business. And the prevailing mantra among developers is to bring a product to market “better, faster, and cheaper” than the competition.

In many ways, the company lives and dies by how they roll out applications. If an application is delayed or goes over-budget, the firm misses out on lucrative opportunities. Yet if the application is rushed, the business runs the risk of encountering high-profile bugs or security failures.

The trick, therefore, is to drive business value through a systematic project management process that is built on strong governance principles and tools to support collaboration and efficiency. That latter piece is where tools like Visual Studio 2010 can be extremely valuable in optimizing the application lifecycle.

Our Visual Studio tutorial videos are a great first step for mastering this important technology that can, over time, help you directly deliver value to your team.


 

(function(){
var s=’hubspotutk’,r,c=((r=new RegExp(‘(^|; )’+s+’=([^;]*)’).exec(document.cookie))?r[2]:”),w=window;w[s]=w[s]||c,
hsjs=document.createElement(“script”),el=document.getElementById(“hs-cta-c6aa8857-3e7e-4761-a672-02016ac3851d”);
hsjs.type = “text/javascript”;hsjs.async = true;
hsjs.src = “//cta-service-cms2.hubspot.com/cs/loader.js?pg=c6aa8857-3e7e-4761-a672-02016ac3851d&pid=153597&hsutk=” + encodeURIComponent(c);
(document.getElementsByTagName(“head”)[0]||document.getElementsByTagName(“body”)[0]).appendChild(hsjs);
try{el.style.visibility=”hidden”;}catch(err){}
setTimeout(function() {try{el.style.visibility=”visible”;}catch(err){}}, 2500);
})();

 

Job Seekers Should Take Note: Microsoft to Phase Out Expression

StartLearningButton

In most industries, the job market generally responds to consumer demand. To use a very simple analogy, think of the auto industry. Let’s say GM rolls out a brand new car and customers respond enthusiastically. As a result, GM will likely direct more resources towards building more of that type of car. And more resources mean more jobs.

The same can’t necessarily be said for the IT industry, and that’s because oftentimes a programming language is so far removed from the end-user customer. After all, consumers don’t wait in line to buy Java code. They wait in line to buy iPods, laptops, and PCs.

So when a major player like Microsoft announces news to consolidate languages and platforms, IT job seekers should pay attention.

Case in point: Microsoft announced it would end its support for some of its Expression design tools in a larger effort to consolidate elements of Expression with Visual Studio. In other words, Microsoft is placing their money on Visual Studio, and job seekers should take note. A good first step would be to check out our Visual Studio 2010 tutorial video.

With these new developments, Microsoft is essentially dictating demand, and in turn, the quantity and quality of jobs associated with this demand.

 


 

(function(){
var s=’hubspotutk’,r,c=((r=new RegExp(‘(^|; )’+s+’=([^;]*)’).exec(document.cookie))?r[2]:”),w=window;w[s]=w[s]||c,
hsjs=document.createElement(“script”),el=document.getElementById(“hs-cta-c6aa8857-3e7e-4761-a672-02016ac3851d”);
hsjs.type = “text/javascript”;hsjs.async = true;
hsjs.src = “//cta-service-cms2.hubspot.com/cs/loader.js?pg=c6aa8857-3e7e-4761-a672-02016ac3851d&pid=153597&hsutk=” + encodeURIComponent(c);
(document.getElementsByTagName(“head”)[0]||document.getElementsByTagName(“body”)[0]).appendChild(hsjs);
try{el.style.visibility=”hidden”;}catch(err){}
setTimeout(function() {try{el.style.visibility=”visible”;}catch(err){}}, 2500);
})();

 

Be the Smart Employee

strange-albert-einstein

 

There was a time when having computer skills defined you as a bit of a “geek”. Then all of the geeks became millionaires, and suddenly, having at least a modicum of computer savvy became extremely important. Nowadays, having a working knowledge of computer programming and web design can lead to promotions at work, career stability, and an increased salary. It pays to spend some time learning how your computer works from the inside out.

Online courses, such as video tutorials for C#, or a Visual Studio 2010 tutorial video, can help you get started on the road to increased computer knowledge. Visual Studio know-how will make you invaluable in developing web sites and mobile applications, and for debugging any existing problems. C# has proven itself as a first class language, so becoming proficient in it will keep you marketable for many years to come. Gone are the days when computer knowledge was synonymous with video games and bad fashion. Today, understanding computers is vital to the success of a business, and positioning yourself as the employee with that understanding is a smart move.

Visual Basic vs Visual C# Smackdown

vbVsCsHelmets

 

Visual C# is similar to Visual Basic, but it has some special features not found in Visual Basic. For example, it supports multi-line comments and static classes along with partial interfaces. Additionally, C# lets you block dangerous codes with a simple keyword.

Visual C# is a great language for developers who want to type less without having to spend much time learning how to use the software. A Visual Studio 2010 tutorial video can show you, step by step, how to master this program.

If you already know how to use C++ and Java, you will pick up Visual C# quickly with a comprehensive C# video course. There are several Visual C# 2010 tutorials available online, but the best course should offer the student videos made only by industry experts.

In a typical C# video course, you will learn how to utilize Windows Communication Foundation (WCF) to build connected, service-oriented applications or take advantage of the MVC (Model-View-Controller) framework to create advanced Web sites. You will also learn how to take advantage of some of the new features introduced in Visual C# 2010. Most video courses also include introductions to object-oriented programming, data manipulation, libraries, and manipulating graphics.

Check out a Visual Studio or Visual C# Video Course Today!