Using Table in LightSwitch Application
Here, we’re going to begin with
one of the most important building blocks of a LightSwitch application, the table. Simply put, a table is a
way of organizing data in columns and rows. If you’ve ever used Excel or
another spreadsheet application you organize your data in rows where each
column represents a field of a specific type of data you are collecting.
Table in LightSwitch:
Applications you build with
LightSwitch are forms-over-data applications that provide user interfaces for
viewing, adding, and modifying data. LightSwitch simplifies the development of
these applications by using screens and tables. Because LightSwitch can work
with other external data sources that do not necessarily have to come from a
database, we sometimes call tables ‘Data
entities’ or just ‘entities’ in
LightSwitch. So whether you have a table in a database or a list in SharePoint,
both the table and the list are entities in LightSwitch. Similarly, a field in
a table or a column in a list is referred to as a property of the entity.
Entities are how LightSwitch
represents data and are necessary to assemble an application. You create these
data entities by using the built-in application database, or by importing data
from an external database, a SharePoint list, or other data source. When you
create a new project in LightSwitch, you need to choose whether you want to
attach to an existing data source or create a new table. If you choose to
create a new table, LightSwitch will create it in the built-in database, also
referred to as the intrinsic database. You then design the table using the Data
Designer.
When you create tables and relate
them together you are designing a data model, or schema. Describing your data
this way takes some practice if you’ve never done it before, however, you will
see that it’s pretty intuitive using LightSwitch. The better you are at
describing your data model, the more LightSwitch can do for you when you create
screens later.
The LightSwitch Data Designer:
The Data Designer is where all
your data modeling happens in LightSwitch whether you’re attaching to an
existing data source or creating a new database. By using the Data Designer,
you can define properties on your entities and create relationships between
them. LightSwitch handles many typical data management tasks such as field
validation, transaction processing, and concurrency conflict resolution for you
but you can also customize these tasks by modifying properties in the
Properties window, and/or by writing code to override or extend them.