Add method, 94
ADO.NET
code writing
calling stored procedure, 220
connection string retrieving, 219
record updation, domain service code, 214–219
data connection, 204
ADO.NET Entity Framework model, 204
Application administrator, 578
ApplicationDatabase.mdf file, 666
ApplicationDataService class, 604, 609
Application deployment, 615
application updation, 650
ASP.Net web site, 648
client requirements, 621
data deployment, 650
IIS7 ZIP file deployment, 649–650
options and tasks, 615
publishing vs. packaging, 621
SQL Server connection string, 649
SQL Server tasks, 616
three-tier browser application, 648
three-tier desktop application, 645–648
topologies application type settings window, 619
browser applications, 620
client topology, 619
two-tier desktop installation
administrative user setup, 644–645
database connection string, 644
Install.htm, 642
setup.exe, 644
wizard files, 643
two-tier/three-tier applications, 616
web server setting (see Web server setting)
Windows Azure (see Windows Azure
wizard, 616)
database configuration page, 637–638
database connections page, 636–637
Publish Application Wizard, 634–636
Application object
IntelliSense options, 90
properties and methods, 91
Application trace
appSettings element, 670
DefaultTraceListener, 667
diagnostic subsystem, 669
messages
output window, 669
TraceInformation method, 667
Trace.TraceError method, 668
Trace.TraceInformation, 667–668
Microsoft.LightSwitch.Trace class, 667
ServiceConfiguration.cscfg file, 671
settings in web.config, 670–671
trace.axd handler, 667
Trace.Axd page, 671
web.config file, 669
ArgumentNullException, 602
ASP.NET, 476
_AuthData connection string, 561
connectionStrings element, 560
ExistingASPApp, 561
IIS 7 Manager, 563
_IntrinsicData connection string, 560, 561
LightSwitch web.config file settings changes, 561–562
machine config key section, 562
new connection string creation, 561
new page creation
port number, 480
SqlDataSource object, 478
project creation
static port, 477
securing access
Forms Authentication, 484
web.config file, 485
Windows Authentication, 483
web.config file, 560
web server setting, 630
web site, 648
AspNetMembershipProvider, 561
AspNetProfileProvider, 561
aspnet_regiis, 676
AspNetRoleProvider, 561
ASPNetSQLMembershipProvider element, 559, 560
Atomicity, Consistency, Isolation, Durability (ACID) principles, 110
AuditDataSource method, 112
Auditing
basic table properties
ArgumentNullException, 602
C# class, 598
Central.Utilities, 597
change table, 597
entityObject, 602
IEntityObjectExtensions VB module, 598
OldValues and NewValues, 597
StorageProperty method, 602
TrackedProperties method, 602
change tracking, 595
customer/order screen, 596
general approach, 595
changes, 596
changes table, 604
disadvantages, 603
EntityName, 603
imports/using statement, 595
specific approach, 595
advantages, 607
changes, 596
disadvantages, 607
SQL databases, 596
Utilities class library, 595
application administrator, 578
current user storage, 584
Do Not Enable Authentication option, 565
helper methods
GetUserName method, 582
holiday request system, 580
log out option creation
authentication cookie, 587
project's build output, 588–589
permissions, 565
debugging, 568
entity set (table) permissions (see Entity set (table) permissions)
LSML file, 566
roles and users assignment, 565
screen setting permissions (see Screen setting permissions)
SecurityAdministration, 568
query
logged-on user, filtering records, 585–586
user, filtering records, 585
roles screen, 579
SubmittedBy property, 583
users screen, 580
AutoCompleteBox control
items setting, 306
nested AutoCompleteBoxes, 308–309
unbound AutocompleteBox, 307
AutoCompleteBox values, 101–102
Business type extensions, 452–454
attributes, 455
ControlFactory attributes, 455–456
Export attributes, 455
creation, 454
implementation, 457
interfaces, 456
IControlFactory interfaces, 457
IResourceProvider interfaces, 457
Change sets
DataWorkspace.ApplicationData.Details, 102
DiscardChanges method, 103
GetChanges method, 104
IsChanged property, 105
methods and properties, 103
OriginalValue property, 105
orginal value retrieve method, 105
ChangePassword and IsValidPassword methods, 121
Client design project, 383
business type extensions
Image file, 462
control extensions, 448
Image file, 448
folders, 383
subfolders, 383
Client project, 382
business type extensions
CentralTypeControl class, 459
CentralTypeControlFactory class, 459–461
Code-Behind file, 458
namespaces, 458
XAML file, 458
CentralTheme Class file, 401–404
control extensions, 443
CentralControl class, 445
CentralControlFactory class, 445–47
namespaces, 445
XAML file, 444
folders, 382
shell extensions, 423
CentralShell Class file, 423–425
Code-Behind file, 426
XAML file, 425
subfolders, 382
Themes folder, 400
XAML file, 404
Command's CanExecute method, 575–576
business type extensions
Editor and Viewer controls, 465
control extensions, 450
LSML file, 416
Metadata folder and files, 384–385
Resources folder and files, 386
Theme folder, 416
Comparison-Type drop-down
global values, 162
literal values, 157
parameters
optional parameters, 158
properties, 158
Concurrency, 116
conflict resolution, code, 119–120
data conflict screen, 116, 118
Connection transactions, 111
Control extensions
element mapping, 451
implementation, 443
interfaces
IControlFactory interface, 443
IResourceProvider interface, 443
Microsoft's sample, 452
types, 439
Custom controls
calling screen code
code to call SaveData, 359
CustomButton, 359
reference to data context, 361
vs. control extensions, 337
Silverlight class library (see Silverlight class)
Silverlight controls
Custom controls, Silverlight controls (cont.)
HyperLinkButton control (see HyperLinkButton control)
Custom validation. see Data validation
customErrors element, 672
application object
IntelliSense options, 90
properties and methods, 91
change sets, 89
DataWorkspace.ApplicationData.Details, 102
DiscardChanges method, 103
HasChanges property, 103
IsChanged property, 105
methods and properties, 103
OriginalValue property, 105
orginal value retrieve method, 105
client and server interaction, 89
concurrency, 116
conflicts resolution, code, 119–120
data conflict screen, 116, 118
Customers table, 90
data source methods, 93
DataWorkspace object, 93
entities, 95
SaveChanges operation, 89
save pipeline
access control methods, 107
EntityFunctions Class, 109–110
Me.Refresh(), VB.NET, 108
phases, 106
Screen_Saved event, 108
server-side code, 109
table designer, 107
this.Refresh(), C#, 108
screen data
AutoCompleteBox values, 101–102
ItemDataBound/ItemCommand type events, 98
text box values, 99
transactions management
ACID principles, 110
ambient transaction creation, 112–114
banking system, 110
database trigger, data insert failure, 114
.NET, 111
reading data, 111
save pipeline, 111
SQL Server Profiler, 115
user data, 121
Data aggregation, RIA service
data source attachment, 211
domain service class, code addition
object context creation, 206–208
link addition, model file, 205–206
Database trigger, 114
Data controls
AutoCompleteBox controls, 255
data grid controls
clickable links setting, 261
paging, sorting, and searching options, 257–258
detail controls, 254
editable control
date picker control, 252
email and money controls, 252
image uploading, 251
multiline text enabling, 252
phone number control, 252
types, 251
Modal Window Picker controls, 255
read-only controls
font label styles, 254
types, 253
Data querying
data sources, 147
entity set queries
creation, 151
Source drop-down box, 151
filtering
graphical designer (see Graphical designer)
LINQ (see Language Integrated Query (LINQ))
not exists/not in queries, 184
query execution, 148
data type, 174
PreprocessQuery method, 173
query type, 147
return entities, 149
RIA services, 148
sorting
parent record, 190
user-defined global values
Date and DateTime data types, 191
LSML editing, 192
user-defined query, 148
Data source extensions, 465
creation, 466
implementation, 467
Server project, 467
Data source methods, 93
Data transactions
ACID principles, 110
banking system, 110
.NET, 111
reading data, 111
rolling back transactions, 114–115
save pipeline, 111
Data types
binary data type, 68
changing data types, 69
choosing field names, 69
datetime data type, 68
double and decimal numeric types, 62, 63
image data type, 68
money business type, 66
phone number business type, 63, 65
string data type, 62
Data updation, RIA service
ADO.NET (see ADO.NET)
SQL Server database, 211
Data validation
client-side validation engine
dependency tracking, 129
entity properties, 129
Silverlight implementation, 130
tracks details properties, 129
custom validation
child collections and records, 137–139
Client/Server/Common Validation Code writing, 126–127
Social Security Number field, 132
uniqueness and duplicates, 132–134
errors, 123
predefined validation
data length validation, 126
field level properties setting, 124–125
range validation, 126
required field validation, 126
programatically accessing validation results, 130–131
screen and entity validation, 123
workflow, 123
DataWorkspace object, 93
DateTime.Now method, 604
DefaultTraceListener, 667
DeleteEmployee permission, 578
DeliveryMethod attribute, 530
Design project, 386
folders, 386
screen template extensions, 431
CentralScreenFactory class, 434–439
Class file, 433
namespaces, 433
subfolders, 386
Details.Dispatcher.BeginInvoke() method, 539
DevExpress Xtrareports, 523
DiscardChanges method, 103
Drill-through reports, 488
Editable Grid Screen template, 231
EditProduct permission, 566
Emails, 525
application type techniques, 525
creation
pickup folder, 539
sending
Outlook message (see Outlook message)
server-side code (see Server-side code)
System.Net.Mail namespace, 525
Entities, 95
entity.Details.OrderStatus.IsChanged method, 528
EntityFunctions class, 109
EntityName, 603
Entity set (table) permissions
access control methods
CanDelete method, 569
CanInsert method, 570
CanRead method, 570
CanUpdate method, 570
SaveChanges_CanExecute method, 570
table/entity set level, 568
Write Code drop-down menu, 568
EventLogTraceListener, 667
Extensions, 365
advanced data entry, 366
business type extensions, 367
control extensions, 367
external data access, 367
screen template extensions, 366
attributes, 396
business type extensions (see Business type extensions)
control extensions (see Control extensions)
creation
LightSwitch 2011, 378
LightSwitch 2011 Extensibility, 379
templates, 379
Visual Studio 2010 Professional, 378
Visual Studio 2010 SP1 SDK, 378
data source extensions (see Date source extensions)
debugging extensions, 468
distribution, 468
Setup file, share, 469
solution configuration, 468
Visual Studio Gallery, 470
enhanced look and feel, 366
shell extension, 366
theme extension, 366
interfaces, 396
LightSwitch Extension Library project (see LibrarySwitch Extension Library project)
screen template extensions (see Screen template extensions)
shell extensions (see Shell extensions)
theme extensions (see Theme extensions)
third-party vendors, 374
ComponentOne, 375
First Floor Software, 375
Telerik, 376
types, 365
Visual Studio Gallery, 367
Extension Manager (see Visual Studio Extension Manager)
LightSwitch Community Extensions (see LightSwitch Community Extensions)
Finding controls, screen code
hiding and showing controls, 281–282
IContentItemProxy method and property, 280
read-only check boxes, 282–283
Forms authentication, 557
application-defined identities, 556
ASP.NET
_AuthData connection string, 561
connectionStrings element, 560
ExistingASPApp, 561
IIS 7 Manager, 563
_IntrinsicData connection string, 560, 561
LightSwitch web.config file settings changes, 561–562
machine config key section, 562
new connection string creation, 561
web.config file, 560
cryptographic hash, 556
identities and passwords, 557
Users administrator screen, 557
GetValueOrDefault method, 98
Globally unique identifier (GUID), 651
Graphical designer
comparison value (see Comparison-Type drop-down)
data query filtering
Comparison Type drop-down, 157
HasChanges property, 103
HasValue property, 97
Helper methods
HolidayRequest table, 583
HTTP protocol, 629
HTTPS protocol, 629
HyperLinkButton control
attributes, 344
data binding expressions, 346–348
IIS7 ZIP file deployment, 649–650
Infragistics, 524
_IntrinsicData entry, 649
IsChanged property, 105
Language Integrated Query (LINQ)
characteristics, 164
Lambda expressions, 168
advantages, 169
syntax
data joining, 168
dataItem variable, 166
IEnumerable<T>, 166
LINQ parts, 166
query execution, 167
Select clause, 166
Layout controls, 246
presentational containers, 246–248
LightSwitch
ApplicationDefinition.lsml File
nested navigation groups, 30–32
references to, 28
screen elements, 30
attaching to existing data
binary data types, 58
database Objects dialog box, 55
Datetimeoffset and unsupported data types, 57
deleting a data source, 59
MySQL data source, 54
refreshing an external data source, 56–57
SharePoint data, 58
WCF RIA services data, 58
authorization (see Authorization)
choice lists
excerpt from LSML File, 71
vs. related tables, 71
reordering items, 70
ClientGenerated project, 35
Common project, 36
components, 5
computed properties
.NET string formatting tips, 80–81
arithmetic calculations, 82–83
returning images, 86
rounding and truncating numbers, 84–86
custom controls (see Custom controls)
data access objects (see Data access objects)
data types
binary data type, 68
changing data types, 69
choosing field names, 69
datetime data type, 68
double and decimal numeric types, 62–63
image data type, 68
mapping with .NET, and SQL, 61
phone number business type, 63–65
string data type, 62
debugging
attaching processes, 45
Autos and Watch Windows, 44
Immediate and Command Windows, 45
Locals Window, 43
queries, 46
Run to Cursor option, 43
threading issues, 47
deletion behavior, 78
entities and properties, 53
extensions (see Extensions)
HTML, 4
illustration of SQL schema, 73, 74
intrinsic database table
moving to external database, 60
properties modification, 59–60
LINQ, 5
many-to-many relationships, 76
object relational mapping system, 5
one-to-many relationships, 72–73
one-to-one relationships, 76
root folder contents
Default.htm, 25
GeneratedArtifacts Folder, 28
_pvt_extensions Folder, 25
ServiceConfiguration.cscfg, 25–26
ServiceDefinition.csdef, 26–27
Silverlight.js, 25
self-referencing relationships, 74, 75
ServerGenerated project, 33, 34
SQL Server (see SQL Server)
Unique Index check box, 69
WCF-RIA, 4
LightSwitch Community Extensions, 372
Spursoft solutions, 373
LightSwitch Extension Library project, 380
Client Design project, 383
folders, 383
subfolders, 383
Client project, 382
folders, 382
subfolders, 382
Common project, 384
Metadata folder and files, 384–385
Resources folders and files, 386
Design project, 386
folders, 386
subfolders, 386
project dialog box, 381
Server project, 387
solution explorer, 381
VSIX project (see VSIX project)
logged-on user, 121
Logoff.aspx Code-Behind, 587–588
LogOff.aspx in Build Output, 588–589
Makecert, 642
MakeUpperCase method, 99
Management Studio, 650
Me.Refresh() method, 108
Message display
ShowMessageBox method, 273–274
Microsoft SQL Server Reporting Services
installation, 486
report creation
BIDS report design surface, 486–487
Cancellation Counts, 486
code writing, 487
data tab/window, 487
design tab, 487
Drill-through reports, 488
minRequiredNonalphanumericCharacters attribute, 559
minRequiredPasswordLength attribute, 559
Modal window control
helper class methods, 294
assembly references, 295
SelectedItem dragging, 293–294
Model-centric architecture
LightSwitch
building blocks, 6
runtime, 7
logic tier
data providers, 11
data service, 8
presentation tier
hosting process, 12
LightSwitch shell, 11
screens, 12
theming service, 16
XML, 7
Model-view-view model (MVVM)
LightSwitch
model part, 17
run time, 18
view and view-Model, 18
Presenter Model (PM) pattern, 17
software design, 16
view model, 17
Navigation menu item
Log Out screen, 592
new data screen addition, 591
Nested navigation groups
illustration, 32
LSML fragment, 31
New Data Screen, 233
Object relational mapping system, 5
OrderStatus_SingleOrDefault method, 101
OriginalValue property, 105
Outlook message
AutomationFactory.IsAvailable, 540, 543
CanExecute method, 543
CreateEmail function, 542
disable code, SendToOutlook button, 543
mail.Send method, 543
SendToOutlook, 542
password changing, 557
PasswordBox control
SetBinding method
calling, 340
Data Context text box, 342
FindControl method, 341
onscreen appearance, 342
System.Windows.Controls
choosing first node, 340
selecting the control, 339
specifying a custom control, 339
passwordFormat attribute, 560
Permissions, 565
debugging, 568
entity set (table) setting
access control setting, 571–572
CanDelete method, 569
CanInsert method, 570
CanRead method, 570
CanUpdate method, 570
SaveChanges_CanExecute method, 570
table/entity set level, 568
Write Code drop-down menu, 569
query access control methods, 577–578
roles and users assignment, 566
screen setting
command's CanExecute method, 575–576
screen's CanRun method, 574–575
security administration, 568
Predefined validation. see Data validation
PreProcessQuery method, 585–586
PropertyMetadata argument, 355
Query
logged-on user, filtering records, 585–586
user, filtering records, 585
Query's CanExecute method, 577
Regular expression validation, 135–136
RepeatableRead level, 111
Reports
adobe PDF documents
output, 522
PDF creation code, 522
silverPDF draw method, 522
silverPDF programming, 519–521
ASP.NET project (see ASP.NET, report creation)
display, LightSwitch screen
URL, 500
Microsoft reporting (see Microsoft SQL Server Reporting Services)
new browser window opening
reporting techniques, 475
simple automation
Microsoft Word template, 504–506
template distribution, 506–508
Word mail merge
RIA services
code writing
data aggregation (see Data aggregation, RIA service)
data updation (see Data updation, RIA service)
creation
assembly references addition, 201
Class Library addition, 201
domain service class addition, 201–203
data aggregation, 199
enternal data source attachment, 200
LightSwitch application
service list selection, 222
WCF RIA service, 220
Save pipeline
access control methods, 107
EntityFunctions class, 109–110
phases, 106
server-side code, 109
Write Code option, 107
SaveChanges_ExecutedFailed method, 107
SaveChanges_Executed method, 107
SaveChanges_ExecuteFailed event, 108
SaveChanges_Executing method, 604
SaveChanges method, 89
SaveEntityChanges method, 604–605
Saving_Executing method, 609
Screen collection property, 99
Screen data
AutoCompleteBox values, 101–102
ItemDataBound/ItemCommand type events, 98
text box values, 99
Screen designer
command bar
edit query button, 236
location, 235
options, 236
label positioning options, 264–265
parts of, 235
Screen Content Tree
data control (see Data controls)
layout control (see Layout control)
nodes, 245
root nodes, 245
customer object, 240
screen query (see Screen query)
Screen designing
code writing
argument value passage, 278–279
control value setting, 279
finding controls (see Finding controls, screen code)
message display (see Message display)
screen events (see Screen events)
screen opening, 278
common screen elements, 227–228
save button, 228
customization scenarios
add/edit screen design, 318–320
empty screen creation, 310–311
home page addition, 310
multiselect data grid, 324–327
static image addition, 312–315
designer (see Screen designer)
runtime screen designer, 265–266
screen addition
data item selection, 227
new screen dialog box, 226
screen data drop-down, 227
screen templates, 226
solution explorer, 227
Silverlight file
ProductDocument table, 327–328
templates
editable grid screen, 231
new data screen, 233
search screen, 234
user interface setting
general property settings, 267
localized application, 267
Screen events
access control events, 272
collection events, 273
screen property events, 273
related collections, 243
selected data item, 242
Screen_Saved event, 108
Screen setting permissions
access control method, 574–575
Save button, 574
Screen template extensions
implementation, 431
interfaces, 429
IScreenTemplateFactory interface, 431
IScreenTemplate interface, 430–431
Microsoft's sample, 439
Screen's CanRun method, 574–575
Search screen, 234
Secure Sockets Layer (SSL), 616, 629–630
Security administration permission, 568
SecurityData method, 121
SelectedItem/SelectedValue property, 101
SendAsync, 528
SendEmailByHyperlink method, 545
SendMail method, 528
Server Explorer
Add Connection dialog box, 38
Add Connection option, 38
ApplicationDatabase file, 40
User Instance option, 39
Server project
LightSwitch Extension Library project, 387
data source extensions, 467
CentralSource class, 467
Class file, 467
namespaces, 467
Server-side code
command/conduit table, 526
Credentials property, 528
DataWorkspace, 535
email attachments, 526
binary data type, 535
Dispatchers.Main.Invoke() method, 539
modified SendMail method, 536–537
SaveChange() method, 539
entity.Details.OrderStatus.IsChanged method, 528
helper class
configuration settings, credentials, 530–532
DeliveryMethod attribute, 530
SendMail method, 528
SmtpClient Credentials property, 530
MailMessage, 528
MailMessage object properties, 532
operation table, 526
Order entity, 527
SaveChanges method, 535
SmtpClient, 528
Updated method, 526
SetShippingDate method, 99
Shell extensions
implementation, 422
interfaces, 422
Microsoft's sample, 427
ShowScreen method, 91
Silverlight class
data binding in XAML, 349
dependency properties
binding to the data context, 355–356
code for registering, 354
code-behind RichTextBoxInternal Control, 352–354
dynamic value resolution process, 350
introduction, 350
PropertyMetadata argument, 355
RichTextBoxInternal.XAML Contents, 351
new class and control creation, 349
slider control, 350
Silverlight controls
HyperLinkButton control (see HyperLinkButton control)
SmtpClient Credentials property, 530
SmtpDeliveryMethod.Network, 530
SmtpMailHelper class, 528
SqlExpressInstanceName, 665–666
SQL Server
connection problems
Data Link Properties window, 674–675
default connection timeout period, 673
invocation target, 673
ping command, 674
SQL2008Srv, 674
UDL file, 674
intrinsic database, 36
intrinsic database connection, Server Explorer, 37, 40
non-english versions, 666
user instance, 37
error, 666
generation failure, 664
SQL Server Compact Edition, 663
SQL Server Express, 663
SQL Server Profiler, 40–42, 115
SQL2008Srv, 674
StorageProperty method, 602
SubmittedBy property, 583
Surname property, 99
System.Net.Mail namespace, 525
SystemTransactions namespace, 111
System.Windows.Browser namespace, 544
TextWriterTraceListener, 667
Theme extensions
control styles, 397
interfaces, 399
ITheme interface, 399
IThemeExtension, 400
Theme Element Load Order, 400
Microsoft's sample, 420
style sheets, 397
this.Refresh() method, 108
TrackedProperties method, 602
TransactionScope object, 111
Troubleshooting, 663
publishing, 676
SQL Server
non-english versions, 666
user instance generation failure, 664
user instances error, 666
User authentication, 551
membership provider
ASP.NET, forms authentication (see Forms authentication)
aspnet_Applications, 558
aspnet_Membership, 558
aspnet_Users, 557
aspnet_UsersInRoles, 558
changing password-complexity rules, 558–559
changing password-encryption settings, 560
Clear option, 560
Encrypted option, 560
Hashed option, 560
UserId, 557
UserName, 557
no authentication, 553
types, 551
windows authentication
allow any authenticated user, 553–555
allow specified users, 555–556
Value property, 97
Visual collection methods, 100
Visual Studio Extension Manager, 368, 369
accessing methods
LightSwitch project properties, 369–370
Visual Studio Tools Menu, 370–371
Author Setting, 391
Description setting, 392
Getting Started Guide setting, 393
Icon Setting, 393
Preview Image setting, 393
Product Name setting, 391
URL setting, 393
internal settings, 393
ID setting, 393
License Terms setting, 395
Locale setting, 394
Supported Framework Runtime setting, 395
supported vs. editions setting, 394–395
VSIX Manifest Designer, 389–390
VslsHost.exe, 620
vs_vslsweb.exe file, 663
Web server setting
ASP.NET configuration, 630
IIS7
IIS application pools, 626–627
LightSwitch prerequisites
components, 630
Microsoft Web Deploy Tool, 633–634
Microsoft Web Platform Installer, 632–633
setup running, 631
Secure Sockets Layer configuration, 629–630
SQL Server Windows authentication, 627–629
Cloud-based service, 650
publishing steps
entering database connection details, 660
self-signed certificate, 659
service configuration page, 658
SSL certificate selection, 659
web portal, 650
hosted service creation, 651–652
storage account creation, 653–654
subscription ID, 651
Windows Communication Foundation Rich Internet Application (WCF RIA) service, 58
3.148.117.212