Index

„„ A CreditRisks tables, 854 DBTransaction, 853 Abstract stream members, 765 IDbTransaction interface, 853 Accelerate() method, 365, 376, 383 ProcessCreditRisk(), 855 Activator.CreateInstance() method, 607 Rollback(), 854 Active Data Objects (ADO). see ADO.NET save points, 854 Adaptive rendering, 1396 test, 857 Add() method, 362 data providers AddAsync() method, 1554–1555 application configuration files, 813 AddComplete() method, 705–706 benefit, 802 add_Exploded() method, 377 C# Console Application project, 812 Add() method, 698, 702, 1588 centric namespaces, 806 AddOne() method, 723 core objects, 802 AddPerson(), 401 DBMS, 803 AddWithThreads, 745 factory pattern (see Data provider ADO.NET factory model) AutoLot database creation IDbConnection parameter, 811 adding test records, 818 , 804 Customers and Orders tables, 820 Microsoft SQL Server, 813 GetPetName() stored procedure, 819 System.Data.OracleClient.dll, 805 Inventory table creation, 815 third-party, 805 table relationships, in Visual Studio, 822 data readers connected layer of, 801 DbDataReader type, 835 AutoLotDataReader, 830 ExecuteReader(), 835 command objects, 834 multiple result sets, 836 connection objects, 830 Read() method, 835 ConnectionStringBuilder objects, 833 string/int, 835 data reader object, 829 DataSets, 800 Console UI–based front end DataTable, 403 AutoLotCUIClient, 846 disconnected layer, 802 element, 847 EF, 802 DeleteCar() method, 850 reusable data access library InsertNewCar() method, 850 AutoLotDAL, 838 ListInventory() method, 849 CloseConnection() method, 838 LookUpPetName(), 851 DbParameter type, 843 Main() method implementation, 847 deletion logic, 840 ShowInstructions() method, 849 insertion logic, 839 statements, 846 InventoryDAL.cs, 838 UpdateCarPetName() method, 851 OpenConnection() method, 838 database transaction, 852 parameterized command APIs, 853 objects, 842 Connection property, 854 selection logic, 841 1603 ■ index

ADO.NET (cont.) ListItems, 1495 stored procedure, 844 Lock() method, 1504 update logic, 841 machine.config file, 1520 System.Data namespaces Page_Load event handler, 1509 core members, 807 Profile property, 1522 database primitives, 806 profile data, 1521, 1524 IDataReader and IDataRecord interfaces, 810 Remove() method, 1503 IDbConnection interface, 807 RemoveAll() method, 1503 IDbDataParameter and IDataParameter Session data (see Session data) interfaces, 809 session variable, 1493 IDbTransaction interface, 808 simple web UI, 1492 System.Data.dll, 801 store session data, 1517 Application_Error() method, 1499 aspnet_state.exe, 1517 Application programming interface (API) InstallSqlState.sql, 1518 COM+, 1023 session state server, 1517 DCOM, 1022 web.config file, 1518 MSMQ, 1023 System.Web.Caching.Cache class, 1505 .NET remoting, 1024 System.Web.HttpApplication Type, 1500 web service standards, 1025 Unlock() method, 1504 XML web services, 1025 UserAddress data, 1524 AsDataView() extension method, 927 view state, 1494 AsParallel() extension method, 739 web.config file, 1520 AspNetCarsSite website ASP.NET web forms AdRotator control, 1455 AutoEventWireup attribute, 1430 AutoLotDAL , 1459 client-side scripting, 1395 BuildCar.aspx content page, 1467 code-behind model default content page, 1456 advantages, 1411 filtering, 1465 AutoLotDAL project, 1413 GridView control, 1460 C# code file, 1413 In-Place edition and deletion, 1461 CodeFile attribute, 1412 inventory content page, 1459 debugging and tracing, 1415 master pages, 1449 Default.aspx.cs, 1412 SiteMapPath type, 1455 *.designer.cs file, 1413 sorting and paging, 1464 example, 1412 TreeView control site navigation logic, 1453 GetData method, 1414 ASP.NET state management code files, 1399 addition custom data, 1496 core events, 1428 Application_End() method, 1504 directory structure application/session state distinction, 1501 App_Code folder, 1419 Application_Start() method, 1502 referencing assemblies, 1419 ASPNETDB.mdf file, 1519 subdirectories, 1418 assignment data item, 1503 Error event, 1430 btnGetCar handler, 1492 features, 1398 CacheDependency object, 1507 HTML (see HTML) Cache.NoSlidingExpiration parameter, 1507 HTTP (see HTTP) Context.Cache property, 1505 IIS (see Internet Information Services (IIS)) cookie (see Cookie) life cycle, 1428 DateTime.Now.AddSeconds parameter, 1507 Load event, 1428 Default.aspx page, 1509, 1522 page type EnableViewState, 1495 inheritance chain, 1420 Event Handler, 1499 properties, 1421 GetUserAddress data, 1525 postback to web server, 1397 Global.asax file, 1497 single-file page model HttpApplicationState Type, 1501 application, 1403 lblUserData Label, 1523 *.aspx file, 1402

1604 ■ Index

AutoLotDAL directory, 1404 GUI, 595 control declarations, 1410 LoadExternalModule() method, 596 data access logic, 1406 VbSnapIn, 593 directives, 1409 application, 593–594 script block, 1410 late binding templates, 1403–1404 CreateUsingLateBinding() method, 576 UI designing, 1406 Invoke Methods, 577 Unload event, 1429 System.Activator class, 574 Web.config file, 1431 TurboBoost() method, 576–577 web controls, 1399 VehicleDescriptionAttributeReader, 587 Web Forms 2.0, 1399 VehicleDescriptionAttribute Web Forms 3.5, 1400 ReaderLateBinding, 588 Web Forms 4.0, 1401 metadata Web Forms 4.5, 1401 Assembly token, 559 Web Forms 4.6, 1402 AssemblyRef #n token, 559 web site vs. web application, 1416 CarLibrary.EngineState enumeration, 556 Assembly-level attribute, 585 get_PetName() method, 558 Asynchronous method invocation ildasm.exe, 556 Add() method, 701 set_PetName() method, 558 AsyncCallback delegate, 703 string literal, 560 AsyncResult Class, 706 TypeRef, 559 AsyncState, 707 .NET attributes BeginInvoke() method, 700 CLS-compliant constructs, 579 EndInvoke() method, 700 constructor parameter, 581 IAsyncResult interface, 700 ildasm.exe, 580 Main() method, 701 notserialized token, 580 thread synchronization, 702 obsolete type, 581–582 Asynchronous programming predefined attributes, 578 AddWithThreads, 745 serializable token, 580 C# async, 741 shorthand attribute, 581 multiple awaits, 744 reflection naming conventions, 743 GetInterfaces() method, 565 void returning, 744 late binding, and custom attributes, 590 Attribute-based programming ListFields() method, 565 custom attribute ListInterfaces() method, 565 AssemblyInfo.cs, 586 Main() method implementation, 566 assembly-level attribute, 585, 587 parameter types, 568 AttributeTargets enumeration, 584 return types, 569 AttributeUsage, 585 System.Collections.Generic.List, 568 class definitions, 583 System.Object.GetType() class, 562 creation, 582 System.Reflection Namespace, 561 module-level attribute, 585 System.Type class, 561–562 named property, 583 System.Type.GetType() operator, 563 dynamic loading Type.GetMethods() method, 564 Assembly class, 569 typeof() operator, 563 Assembly.Load() method, 571–572 Autoincrementing ability, 865 AssemblyName type, 572 AutoLotDAL Version 4 ExternalAssemblyReflector class, 570 AutoLotTestDrive (see AutoLotTestDrive) LINQ, 573 BaseRepo addition extendable application Add() and AddRange() methods, 970 building process, 591 DbSet property, 968 CommonSnappableTypes.dll, 591 Delete()/DeleteAsync() methods, 972 CSharpSnapIn, 592 IDisposable interface, 971 DisplayCompanyData() method, 596 initial class definition, 967 external assemblies, 597 retrieving records, 970

1605 ■ index

AutoLotDAL Version 4 (cont.) Binary operators, 405 SaveChanges() helper methods, 968 Binding notification system Save()/SaveAsync() methods, 972 adding bindings and data, 1333 CreditRisk class, 963 observable models CreditRiskRepo, 974 nameof method, 1338 customer model class, 961 PropertyChanged event, 1336 CustomerRepo, 973–974 observable models (see Observable models) data annotations, 957 vehicle data, 1335 DataInitialize, 975 BuildTableRelationship() helper function, 899 DbContext addition, 964 BundleConfig, 1536 DropCreateDatabaseAlways class, 975 DropCreateDatabaseAlways class, 975 „„ C DropCreateDatabaseIfModelChanges C# access modifiers, 179 class, 975 Callback functions, 355 inventory model class, 959 CallMeHere() method, 370 Inventory repository, 973 Cancel() method, 740 IRepo interface addition, 966 CanExecute method, 1368 NuGet packages, 956–957 CanHelpExecute() method, 1179 order model class, 961 CarLotMVC project. see Model-View-Controller OrderRepo, 973 (MVC) pattern Seed() method, 975 C# constructs AutoLot database, 932 arrays AutoLot database, 932 ArrayOfObjects() method, 123 adding test records, 818 creation, 121 Customers and Orders tables, 820 GetStringArray() method, 125 GetPetName() stored procedure, 819 implicitly typed local arrays, 122 Inventory table creation, 815 initialization syntax, 121 table relationships, in Visual Studio, 822 JaggedMultidimensionalArray(), 125 AutoLotTestDrive PrintArray() method, 125 connectionStrings updation, 976 RectMultidimensionalArray(), 125 inventory records Reverse()/Clear() methods, 126 Add() or AddRange() method, 977 SimpleArrays() method, 121 editing, 978 System.Array class, 126 printing, 977 System.Object.GetType() method, 123 Main() method, 977 enum type MakeCustomerARisk() method, 980 definition, 128 navigation properties enumeration value, 131 eager loading, 980 Enum.GetUnderlyingType() method, 131 output window, 979 magic numbers, 129 ShowAllOrders() method, 979 name-value pair, 132 PrintAllCustomersAndCreditRisks() storage value, 129 method, 981 System.Enum type, 130 underlying type, 129 variable declaration, 129 „„ B methods, parameter modifiers, 109 BasicStringFunctionality() method, 84 CalculateAverage() method, 114 BeginInvoke() method, 357–358, 700, 706, 726 DisplayFancyMessage() Binary Application Markup Language (BAML), 1116 method, 117 BinaryFormatter type, 781 logical parameter, 114 BinaryFormatter.Serialize() method, 784 method overloading, 118 Deserialize() method, 785 named arguments, 117 network stream, 784 optional parameters, 115 SaveAsBinaryFormat() method, 784 out modifier, 111

1606 ■ Index

output parameters, 113 assembly’s metadata, 521 positional args, 117 CarLibrary.dll, 521 reference parameters, 113 C# class library, 514–515 by value, 110 C# client application, 522 by variable, 111 CIL code, metadata, and assembly nullable types manifest, 514 assignment operator, 138 CLR header, 513 conditional operator, 147 code library, 510 data type, 144 code reuse, 510 equality operator, 146 cross-language inheritance, 525 GetBoolFromDatabase() method, 145 DerivedCars.cs, 516 if/else condition, 147 embedded resources, 514 null coalescing operator, 146 Exploring the CIL, 520 PointRef type, 138 GUI editor, 519 rectangle type, 139 GUI Properties editor, 520 SendAPersonByReference() method, 142 ildasm.exe, 518 SendAPersonByValue() method, 141 manifest data, 518 value types vs. reference types, 139, 143 self-describing, 511 structure unique types, 510 custom constructor, 135 versionable units, 511 default constructor, 135 visual basic console application, 523–524 definition, 133 Windows file header, 512 types, 133 XML configuration files, 511 variable creation, 135 Private assemblies C# dynamic keyword App.Config File, 529–530 dynamic data variable, 601 Configuration files, 527 limitations, 604 CSharpCarClient.exe, 528 practical uses, 605 MyLibraries subdirectory, 528 scope, 603 privatePath attribute, 529 C# extension methods, 442 probing process, 526 Common intermediate language (CIL), version number, 526 dynamic assemblies publisher policy assemblies C# Iteration Constructs disable policy, 548 foreach loop, 102 input parameters, 548 for Loop, 101 element, 549 while and do/while loop, 103 publickeytoken value, 550 Class libraries Shared Assemblies Configuration File Schema, 552–553 AssemblyInfo.cs file, 535 custom namespace assembly-level attributes, 534 BinaryFormatter class, 507 assembly manifest, 542 Circle.class, 504 bindingRedirect, 546 class definition, 503 CarLibrary 2.0.0.0, 544–545 compile-time errors, 506 command prompt, 535 custom alias, 507 configuration files, 542 default namespace, 509 Console window, 540 fully qualified name, 505 current version, 543 My3DShapes namespace, 508 digital signature, 534 MyShapes namespace, 504 gacutil.exe, 539 name clashes, 506–507 higher libraries, 533 root namespace, 509 historical GAC, 532 ShapesLib.cs, 503 MyTestKeyPair.snk, 535 .NET assemblies referenced library, 540 abstract base class, 515 SharedCarLibClient, 541 Add Reference dialog box, 517 SharedCarLibClient.exe, 547 .assembly extern token, 518 *.snk file, 538

1607 ■ index

Class libraries (cont.) Emit() method, 690 strong name, 533 .field directive, 670 Visual Studio, 537 HelloWorld class type, 689 System.Configuration namespace, 550 member parameter, 672 ClearErrors() method, 867 mnemonic distinction, 654 Client-side scripting, 1395 ModuleBuilder Type, 688 CloneMe()method, 277 Module Set, 688 CloseConnection() method, 838 motivations, 652 Collection Classes .NET application, 652 arrays, 315 .NET class library, 669 generic collections (see Generic collections) opcodes, 653–654 nongeneric collections (see Nongeneric iteration constructs, 677 collections) local variable declaration, 675 System.Collections mapping parameters, 676 ArrayList, 318 .maxstack directive, 675 Classes, 319 member implementation, 673 key interfaces, 317 nonstatic method, 677 types, 317 Pop-Centric, 674 types, 316 Primary Stack-Centric, 674 ColorChanged() method, 1198 this reference, 677 Commit() method, 854 OpCodes.Call method, 690 Common Intermediate Language (CIL), 520 platform-specific instructions, 12 AppDomain.DefineDynamicAssembly() properties and methods, 671 method, 688 pushing and popping, 654 AppDomain.DefineDynamicModule() round-trip engineering method, 688 branching/looping constructs, 659 attributes, 653 C# console app., 656 benefits, 12 code labels, 659 Calc class, 10 common .exe, 661 CILCarClient.exe, 681 default constructor, 658 CILCars.dll, 678 HelloProgram.il file, 657, 662 C# keywords, 669 *.il file, 660 CreateMyAsm() method, 691 load-centric, 659 create MyAssembly.dll, 685 MessageBox.Show() method, 661 custom constructor, 690 mscorlib, 660 data type mapping, 669 peverify.exe, 662 define constructor, 671 SayHello() method, 691 DefineDefaultConstructor() method, 690 string member variable, 689 define field data, 670 System.AppDomain type, 686 directives and attributes, 653 System.Reflection.Emit.ILGenerator, 684 assembly declaration, 663 System.Reflection.Emit namespace, 683 CILTypes assembly, 664 TypeAttributes enumeration, 689 CILTypes.il file, 668 (CLR), 4 .class Directive, 666 definition, 20 common assembly-level directives, 664 key difference, 20 CTS structure, 667 mscoree.dll, 21 define class type, 665 Common Language Specification (CLS), 4 enum attribute, 667 compliance, 20 external assemblies, 663 programming constructs, 18 generic member, 668 rules, 19 implementing interface, 666 Common Type System (CTS), 4, 1024 MyBaseClass namespace, 665 class types, 15 .namespace directive, 664 delegate types, 17 type parameter, 668 enumeration types, 16

1608 ■ Index

interface types, 15 members, 84 intrinsic data types, 18 StringBuilder, 89 structure types, 16 string equality, 88 type members, 17 string interpolation, 90 Comparison operators, 410 verbatim string, 87 Component Object Model (COM), 3 System.TimeSpan, 81 ConfigureGrid() function, 1216 variable declaration, 75 Console.WriteLine() method, 395 C# programming language Contact() action method, 1542 anonymous types ControlTemplate class, 1316 definition, 424 Convert() method, 1214 equality, 427 ConvertBack() method, 1214 internal representation, 425 Cookie ToString() and GetHashCode() CookieStateApp, 1514–1516 implementation, 427 definition, 1514 custom type conversions HttpCookie.Expires property, 1515 class types, 412 HttpRequest.Cookies property, 1515–1516 custom conversion routines, 413 C# parameter modifiers, 110 explicit conversions, Square type, 416 C# programming implicit conversion routines, 417 BigInteger data type, 82 numerical conversions, 412 class hierarchy, 78 extension methods conditional operators, 105 definition, 419 data type conversion importing, 421 checked keyword, 94 IntelliSense of, 422 class Program, 91 interfaces, 422 implicit widening, 92 invoking of, 420 narrowing operation, 92 indexer definition, on interface types, 404 project-wide overflow/underflow data indexer methods, 399 checking, 96 multiple dimensions, 403 unchecked keyword, 96 overloading, 402 if/else statement, 104 string index values, 401 implicitly typed local variables operator overloading DeclareExplicitVars() method, 97 binary operators, 405 restrictions, 98 equality operators, 409 strongly typed data, 99 MiniVan class, 411 uses, 100 += and –+ operators, 408 intrinsic data types, 74, 77 unary operators, 408 iteration constructs (see C# Iteration Constructs) pointer types Main() method (see Main() method) field access, 435 numerical system type, 79 keywords, 430 parsing values, 81 pinning reference, 436 Relational/Equality Operators, 104 sizeof Keyword, 437 SimpleCSharpApp, 61 stackalloc Keyword, 435 switch statement, 105 unsafe (and safe) swap function, 434 System.Boolean data type, 80 unsafe keyword, 431 System.Char type, 80 Create() action method, 1552, 1596 System.Console Class (see System.Console Class) CreateDataReader() method, 922 System.DateTime, 81 CurrentNumberChanged() method, 1226 System.Environment Class (see System. Custom commands Environment Class) AddCarCommand System.String command class, 1373 basic string manipulation, 84 XAML, 1374 concatenation, 85 CommandManager escape characters, 86 creating CommandBase class, 1370 immutability, 88 updating ChangeColorCommand Class, 1370

1609 ■ index

Custom commands (cont.) development, 864 ICommand interface, 1367 properties, 863–864 RemoveCarCommand Data provider factory model command class, 1372 element, 828 XAML, 1373 DbProviderFactory, 823 testing application, 1370 drawback, 827 updating MainWindow.xaml, 1369 Main() method, 825 updating MainWindow.xaml.cs, 1368 System.Configuration.dll, 824 CustomDepPropApp, 1222 System.Data.Common namespace, 823 Custom Generic System.Data.OleDb, 826 default keyword, 349 DataRowExtensions.Field() extension method, 926 DisplayBaseClass method, 346 DataRows Point types, 347 DataRowVersion property, 869 Swap method, 344, 346 DataTable.NewRow() method, 867 type parameters, 346 key members, 866–867 Custom method, 385 RowState property, 868 C# Windows OS DataSet .NET Framework documentation system, 50 anatomy, 861 Visual Studio 2015 Professional IDE, 50 development, 863 Visual Studio Community, IDE ExtendedProperties property, 861 Class Designer Toolbox, 48 LINQ (see LINQ programming) Class Details window, 47–48 methods, 862 class diagram file, 46 properties, 861–862 Class Diagram viewer, 47 Tables property, 861 class visualization, 49 DataSet Extensions Library, 923–924 project types, 45 DataTable.NewRow() method, 867 Visual Studio Express, IDEs DataTableReader objects, 873–874 Add Reference, 42 DataTables Express for Web, 44 binding Windows Forms GUI members, 36 DataView type, 885–887 new project creation, 37 deleting rows, 881–882 Object Browser, 41 hydrating from generic List, 878–880 Project Properties window, 43 initial GUI, 878 setting breakpoints, 39 selecting rows, 882–884 Solution Explorer, 40 updating rows, 885 tools, 36 inserting into DataSets, 871 key members, 871 LINQ programming, 927 „„ D obtaining data in DataSet, 872 Data adapters processing using DataTableReader filling DataSet with single table, 888–890 objects, 873–874 mapping database names to friendly serializing in binary format, 876–877 names, 890–891 serializing as XML, 874–876 members, DbDataAdapter class, 888 DbDataAdapter class, 888 multitabled DataSet objects and data Default application domain relationships, 897–898 AssemblyLoad event, 640 properties, 888 loaded assemblies, 639 strongly typed, 913–914 Default constructor, 157 Data annotations Delegate.Combine() method, 367 ErrorTemplate, 1365 Delegate type System.ComponentModel.DataAnnotations, 1363 BeginInvoke() method, 357 validation errors, 1363 BinaryOp class, 357, 362 DataColumn C# anonymous methods adding objects, 866 AboutToBlow event, 386 autoincrementing fields, 865 accessing local variables, 387

1610 ■ Index

Car class, 385 Disconnected functionality pseudocode, 386 configuring the data adapter, 892–893 C# events defining Initial Class Type, 892 Accelerate() method, 376 implementing GetAllInventory(), 894 add_Exploded() method, 377 implementing UpdateInventory(), 894 boilerplate code, 374 setting version number, 894 CarDelegate, 374 testing, 894–896 CarEngineHandler objects, 375 Disconnected layer. see DataSet CarEvents, 376 DisplayDefiningAssembly(), 420 cleaning up event invocation, 381 DisplayDelegateInfo() method, 362 custom event arguments creation, 382 DisplayMessage() method, 373 custom method, 385 DisplayTable() helper method, 849 event registration, 380 Dispose() method, 1549, 1558, 1588 Generic EventHandler Delegate, 384 Distributed Component Object Model (DCOM), 1022 incoming events, 378 Distributed system, 1021 registration and unregistration methods, 376 Download cache, 549 remove_Exploded() method, 377 DownloadStringAsync() method, 735 definition, 356 DoWork() method, 742, 744 delegate object, 361–362 Dynamic data EndInvoke() method, 357 COM interop pain points, 614 GenericDelegate, 371 COM interop using C#, 615 generic Action<> and Func<> delegates, 372 COM interop without C#, 619 MyGenericDelegate, 371 interop metadata, 613 StringTarget() method, 372 primary interop assemblies, 612 Invoke() method, 357 (DLR) Main() method, 361 expression trees, 606–607 MyDelegate, 358 System.Dynamic Namespace, 606 MyOtherDelegate, 358 object state notifications Accelerate() method, 365 „„ E CarDelegate, 364 Edit() action methods, 1549, 1554, 1555, 1597 CarEngineHandler, 364 Enable() method, 1206 listOfHandlers, 364 EnableAnnotations() method, 1206 Main() method, 366 Encapsulation method group conversion syntax, 369 automatic properties multicast enable, 366 default values, 192 OnCarEngineEvent() method, 366 DisplayStats() method, 192 Program class, 365 expected property syntax, 192 RegisterWithCarEngine() helper method, 365 initialization of, 194 RegisterWithCarEngine() method, 364 read-only automatic property, 191 Remove() method, 368 syntax, 191 updates, 364 write-only property, 191 pseudocode, 358 C# access modifiers, 179 SimpleDelegate, 360 C# class type SimpleMath, 361 Car variable, 154 SquareNumber() method, 361 insertion, 152 System.Delegate base classes, 359 member variables, 151 System.MulticastDelegate, 356, 359 objects allocation, 154 Delete() action methods, 1556, 1598 PrintState(), 153 DeleteAsync() extension method, 1599 SpeedUp(), 153 DeleteCar() method, 850 class definition, 181 Delete()/DeleteAsync() methods, 1574 constant field data, 199 DependencyProperty.Register() method, 1219–1220 constructors Dequeue() method, 338 custom constructors, 156 Details() action method, 1551, 1596 default constructor, 155

1611 ■ index

Encapsulation (cont.) entity names, 942 keyword FluentAPI, 944 constructor chaining, 161 Key attribute, 943 constructor flow, 163 Order class, 943 IntelliSense, 160 Orders and Inventory relationship, 944 Main() method, 160 StringLength attribute, 943 optional arguments, 165 SuppressMessage attributes, 943 SetDriverName(), 159 table attribute, 943 .NET properties, 184 AutoLotDAL Version 4 (see AutoLotDAL object initialization syntax Version 4) custom constructors, 197 AutoLot database, Inventory table, 932 initializing data, 198 building blocks objectInitializers, 196 DbContext class, 935–936 point objects, 196 DbSet, 936 OOP empty code first model, 937 Draw() method, 178 Entity State, 937 encapsulation, role of, 175 System.Data.Entity.dll assembly, 934 “has-a” relationship, 176 transaction support, 937 inheritance, role of, 175 concurrency, 991 “is-a” relationship, 176 connected layer, 930–931 polymorphism, 177 convention and configuration, 932 partial classes, 202 DataSet class, 930 properties, 187 disconnected layer, 930–931 read-only property, 189 EDM, 932 static keyword EDMX file, 929 importing static members, 174 goal, 929 static classes, 173 in-house application, 931 static constructors, 170 interception static field data, 167 ConsoleWriterInterceptor, 994 static methods, 169 DatabaseLogger interceptor, 995 utility classes, 166 IDbCommandInterceptor interface, 993 WriteLine() method, 166 registering, 995 static properties, 190 WriteInfo() method, 994 traditional accessors and mutators, 182 LINQ queries, 929–930 write-only property, 189 LINQ to SQL, 931 EndInvoke() method, 357–358, 700 migrations Enqueue() method, 338 baseline migration, 985 EnterLogData() method, 115 concurrency checking, 982 Entity data model (EDM), 932 Credit Risk class, 984 Entity data model XML (EDMX) file, 929 Customer class, 983 Inventory class, 982 AddRecords() method, 930 __MigrationHistory table, 985 AutoLotConsoleApp Order class, 983 ADO.NET EDM project item Seed() method, 989 insertion, 939 System.InvalidOperationException, 984 AutoLotConnection, 940 Timestamp property, 982 configSection, 944 model classes (see Model classes) Customer and Orders relationship, 944 ObjectContext class data annotations, 942–943 accessing, 996 database selection, 940–942 ObjectMaterialized event, 996 DbSet property, 944 SavingChanges event, 997 default mappings, 945 POCO classes, 932 designer-generated classes, 946 runtime, 931 EDM generation, 940 SQL Server Express, 998

1612 ■ Index

table adapter supports methods, 930 „„ G transaction test, 990 Entity Framework (EF), 802 Generic collections ExecuteNonQuery() method, 837 benefits, 327 ExecuteReader() method, 837 type parameters constraints, 350 generic class/structure, 328 „„ F generic interfaces, 330 File I/O generic items, 327 BinaryReader object, 772 generic members, 330 BinaryWriter object, 772 operator constraints, 352 Directory.GetLogicalDrives() method, 756 where clause, 351 DirectoryInfo.CreateSubdirectory() GetAllInventory(), 894 method, 754–755 GetAllInventoryAsList() method, 850 DirectoryInfo Type, 752 GetChildren() method, 1313 DriveInfo.GetDrives() method, 757 GetCoffee() funtion, 338 File types, 762 GetCommandLineArgs() method, 66 FileAccess enumeration, 760 GetErrors method, 1359 file-centric members, 763 GetInventory() method, 1077, 1589 FileInfo.AppendText() method, 762 GetInventory(int id) method, 1589, 1592 FileInfo class, 758 GetOneAsync() method, 970, 1592 FileInfo.Create() method, 759 GetOne() method, 970 FileInfo.CreateText() method, 762 GetPerson(), 401 FileInfo.Open() method, 759, 761 GetValue() method, 1219 FileInfo.OpenText() method, 761 Global.asax.cs file, 1534 FileInfo types, 762 (GAC), 532 FileMode enumeration, 760 Globally unique identifier (GUID), 534, 863 FileShare enumeration, 760 Graphical rendering, WPF FileStream object, 759 adding rectangles, ellipses, and FileSystemEventHandler, 774 lines, 1233–1236 FileSystemInfo type, 750 brushes and pens FileSystemInfo Base Class, 751 Brush-derived types, 1243 FileSystemWatcher type, 774 configuring in code, 1247–1248 GetFiles() method, 754 configuring pens, 1248 GetStringBuilder() method, 771 configuring using visual MemoryStream object, 773 studio, 1243, 1245, 1247 MyFolder directory, 774 drawings and geometries Stream class building DrawingBrush using CreateText() method, 768 geometries, 1259–1260 File.CreateText() method, 768 containing drawing types in FileStreams type, 765 DrawingImage, 1261–1262 StreamReader types, 770 Drawing class, 1258 StreamWriter type, 767, 770 Drawing-derived types, 1258–1259 StringReader type, 767 DrawingImage, 1259 TextReader class, 769 Drawing vs. Shape types, 1259 TextWriter class, 767 painting with DrawingBrush, 1260–1261 StringReader object, 770 graphical transformations (see Graphical StringWriter object, 770 transformations) System.IO namespace, 749 options, 1230 System.IO.NotifyFilters enumeration, 774 path Fill() method, 810 Geometry-derived classes, 1239–1240 FilterConfig, 1537 key members, 1239 FormatNumericalData() function, 72 mini-language, 1241–1242

1613 ■ index

Graphical rendering, WPF (cont.) „„ I polylines and polygons, 1238 removing rectangles, ellipses, IAsyncResult interface, 700 and lines, 1236–1238 IDbCommand interface, 808 Shape base class, 1231–1233 IDbDataAdapter and IDataAdapter vector images (see Vector images) interfaces, 809 visual layer (see Visual layer) IgnoreRoute() method, 1543 Visual Studio transform editor (see Visual ImageMagick tool, 1263 Studio transform editor) Immediate-mode graphical systems, 1229 Graphical transformations Index() action method, 1543, 1549, 1555, 1595 adding a final , 1251 Indexer methods, 399 adding final Boolean member Inheritance and polymorphism variable, 1252–1253 abstract classes, 225 Button with skew transformation, 1250 base/derived class, 234 Click event handler, 1251 basic mechanics, 205 Ellipse scaled by 20%, 1250 Car class, 206 Rectangle with rotate transformation, 1250 containment/delegation rendering entire , 1251 GetBenefitCost(), 217 TextBox responsive to keyboard input, 1250 “has-a” relationship, 217 TextBox rotated and skewed, 1250 Main() method, 218 Transform-derived classes, 1249 nested type definitions, 218 undefined clipping region, 1252 controlling base class, 213 Employee.cs and Employee.Core.cs files, 212 GiveBonus(), 220 „„ H “is-a” relationship, 205, 217 HasErrors property, 867 Manager class, 212 HelpExecuted() method, 1179 master parent class HTML Main() method, 240 definition, 1388 ObjectOverrides, 239 document structure, 1388 person class, 243 form, 1390, 1394 static members, 244 Visual Studio, 1390 System.Object, 238, 240 HTTP System.Object.Equals(), 241 browser statistics, 1422 System.Object.GetHashCode(), 242 btnGetFormData_OnClick value, 1425 System.Object.ToString(), 240 HttpRequest class type, 1421 multiple base classes, 208 HttpRequest.Form property, 1425 parent class, 206 HttpRequest.QueryString property, 1425 polymorphic interface HTTPResponse type abstract methods, 230 HttpResponse.Write() method, 1427 Draw() method, 229–230 HttpResponse.WriteFile() method, 1427 Main() method, 230–231 methods, 1427 shadowing, 232 properties, 1426 shapes hierarchy, 228 users redirection, 1427 virtual and abstract methods, 228 IsPostBack property, 1426 protected keyword, 215 MapPath() method, 1422 SalesPerson class, 212 request/response cycle, 1385 sealed class, 216 SaveAs method, 1422 sealed keyword, 208 stateless protocol, 1386 sealing virtual members, 225 Text property, 1425 virtual and override keywords, 221 ValidateInput() method, 1422 Visual Studio class diagrams, 210–211 HttpRequest.Browser property, 1396 Visual Studio IDE, 223

1614 ■ Index

InitializeComponent() method, 1178 null reference, 284 INotifyPropertyChanged interface, 1336 ThreeDCircle and Hexagon, 285 InsertAuto() method, 843, 850, 1079 types, 276–278 InsertCar() method, 1077 Visual Studio class diagram, 286 InsertNewElement() method, 1016 Visual Studio support, 289–290 Interfaces Interlocked.Exchange() method, 723 abstract base classes, 278 Internet Information Services (IIS) abstract members, 275 Default Web Site node, 1386 arrays, 288–289 Express, 1387 CloneMe() method, 285 virtual directories, 1387 cloning process Inventory() method, 1591 class named Point, 302–304 InventoryList ICloneable interface, 303 Clear method, 1343 MemberwiseClone() method, 304 NotificationCollectionChangedAction.Add PointDescription type, 304–307 value, 1342 custom interfaces NotificationCollectionChangedAction.Remove access modifier, 279 value, 1343 class/structure, 280 OnCollectionChanged method, 1341 compiler errors, 280 RemoveAt method, 1343 IPointy, 279 Invoke() method, 357–358, 361, 698 namespace, 279 IsEvenNumber() method, 389 read-only property, 280 explicit interface implementation Draw() method, 291, 293 „„ J, K InterfaceNameClash, 291 JavaScript Object Notation (JSON), 1586, 1591 Octagon type, 292 Hexagon type, 283 IComparable interface „„ L Car class, 307–308 Lambda expressions custom static property, 311–312 dissection, 391 definition, 307 lambdas and single statement member int data type, 309 implementations, 395 internal CarID, 308 multiple/zero parameters, 393 return values, 309 processing arguments, multiple statements, 392 sort order, 310–311 retrofitting CarEvents, 395 System.Array class, 308 SimpleLambdaExpressions, 388 IDbConnection, 275 LambdaExpressionSyntax() method, 392 IDraw3D interface, 286–287 Language Integrated Query (LINQ), 5 IEnumerable and IEnumerator LayoutTransform property, 1249 array type, 297 LinqOverDataTable() method, 923 Garage, 297–298 LINQ programming GetEnumerator() method, 298 DataRowExtensions.Field() extension iterator method, 300 method, 926 named iterators, 301–302 DataSet Extensions Library, 923–924 System.Collections namespace, 299 hydrating new DataTables, 927 implementation, 281–282 LINQ-compatible DataTable, 924–926 InterfaceHierarchy LINQ programming model BitmapImage, 294 aggregation operations, 465 drawing behavior, 294 anonymous types, 443 IAdvancedDraw, 294 C# LINQ query operators, 457, 459 MIInterfaceHierarchy, 295–296 Count() extension method, Enumerable rendering-centric interfaces, 293 class, 462 InvalidCastException, 283 data types, 460 Main() method, 283–285 removing duplicate, 465 method return values, 287–288 Reverse<>() extension method, 462

1615 ■ index

LINQ programming model (cont.) Load() and Parse() methods, 1014 selection syntax, 459 SimpleInventory.xml file, 1011 sorting expression, 463 UTF-8 encoding, 1011 subsets of data, 460 XmlDocument and XmlElement classes, 1002 Core LINQ assemblies, 444 XML document creation, 1002 data, API uses, 443 ListInventory() method, 849 DataSet, 444 Load() method, 842 entities, 444 LogicalTreeHelper class, 1313 expressions, 444 LookUpColorsForMake() method, 1017 extension methods, 442 Lambda expressions, 441 local variables, 440 „„ M object and collection initialization syntax, 440 MagicEightBallServiceLib., 1038 queries, 444 Main() method, 361–362, 366, 394, 699, 702, 717, and extension methods, 449 825, 833, 847 and local variables, 448 application error code, 64 contained subobjects, 455 command-line arguments, 65 deferred execution, 450 Program class, 62 enumerable type and anonymous refactored, 378 methods, 469 variations, 63 enumerable type and lambda MapPath() method, 1422 expressions, 467 MapRoute() method, 1543 enumerable type and raw delegates, 469 Metadata exchange (MEX), 1047 filtering data, OfType( ), 457 Method overloading immediate execution, role of, 451, 453 Add() method, 119 nongeneric collections, 456 class definition, 119 query expression, 446 IntelliSense list, 120 query operators, 467 Microsoft Message Queuing (MSMQ), 1023 QueryOverStrings() method, 445, 447 Microsoft .NET platform result set, 447 assembly manifest, 14 Venn Diagramming Tool, 463 assembly/namespace/type distinction, 22 XML, 444 base class libraries, 5 LINQ technology, 429 CIL (see Common Intermediate Language LINQ to SQL, 931 (CIL)) LINQ to XML CLI Partitions, 31 In-Memory XML document CLR (see Common Language Runtime (CLR)) GUI, 1014 CLS (see Common Language Specification (CLS)) Helper class, 1016 Common Language Runtime, 4 Inventory.xml file, 1015 Common Language Specification, 4 Windows Forms application, 1014 Common Type System, 4 Inventory.xml file, 1002 COM programming model, 3 LinqToXmlFirstLook project, 1001 C# programming language, 6 System.Xml.dll assembly, 1001 features, 4 System.Xml.Linq namespace, 1003 ildasm.exe, 28 axis methods, 1008 CIL code, 29 class hierarchy, 1007 manifest data, 30 members, 1007 metadata, 30 XNamespace, 1009 IL instructions, 9 top-down code, 1003 managed vs. unmanaged code, 7 VB literal syntax, 1004 metadata, 9 XElement and XDocument project, 32 arrays and containers, 1012 multilanguage applications, 8 example, 1010 namespace programming, 25 hypothetical style sheet, 1012 .NET Core framework, 32 inventory items, 1011 .NET Distributions, 32

1616 ■ Index

.NET metadata, 13 EditorFor() HTML helper, 1571 .NET Namespaces, 24 LabelFor helper, 1572 root namespace, 23 Delete view, 1574 Windows\Assembly\GAC, 26 Details view, 1570 Microsoft Transaction Server (MTS), 1023 Edit view, 1576 Model classes home page updation, 1581 DbSet collection, 948 Index view LINQ queries, 949 data annotations, 1565 Main() method, 948 DisplayFor(), 1565 navigation properties DisplayNameFor() HTML helper, 1565 eager loading, 952 GlyphIcons, 1568 explicit loading, 953 header update, 1566 JOIN operations, 951 updated table, 1567 lazy loading, 952 layouts, 1561 virtual ICollection, 951 Layout view updation, 1580 PrintAllInventory() method, 948 model, 1527 record deletion MVC5, 1529 EntityState, 954 MVVM, 1527 Find() method, 954 NuGet Packages updation, 1539 record insertion, 947 partial views, 1563 record updation, 955 project creation SqlQuery, 949 authentication options, 1531 Model-View-Controller (MVC) pattern generated files and folders, 1533 adding, 1529 new ASP.NET web application, 1530 ASP.NET Web Forms, 1528 selection, 1531 AutoLotDAL project, 1545 Razor View Engine, 1558 components HTML helpers, 1559 App_Start folder, 1536 Razor delegates, 1560 ASP.NET folders, 1535 Razor functions, 1560 Bootstrap, 1538 Razor syntax, 1558 Content folder, 1538 removing, 1529 Controllers folder, 1534 routing Fonts folder, 1538 ActionLink() HTML helper, 1544 Models folder, 1534 Contact() action method, 1542 project root files, 1533 creation, 1543 Scripts folder, 1538 _Layout.cshtml file, 1544 Views folder, 1535 URL patterns, 1542 controllers and actions, 1528 strongly type views, 1565 ActionResult-Derived classes, 1550 TempData, 1564 Create() action method, 1552 test-drive, 1540 Delete() action methods, 1556 validation Details() action method, 1551 client-side, 1579 Dispose() method, 1549, 1558 server-side, 1578 Edit() action method, 1549, 1555 ViewBag, 1564 inventory repository, 1550 ViewData, 1564 Index() method, 1549–1550 view models, 1565 inventory controller, 1546 Model-View-ViewModel (MVVM) pattern, 1527 InventoryController.cs class, 1549 anemic models, 1331 Web start action updation, 1549 application, 1329–1330 convention over configuration, 1529 AutoLotDAL Create view base class, 1376–1377 add inventory view, 1574 INotifyPropertyChanged, 1378–1379 AntiForgery token, 1572 inventory partial, 1377–1378 BeginForm() HTML helper, 1572 ConnectionStrings node, 1379 Bootstrap, 1573 definition, 1330

1617 ■ index

Model-View-ViewModel (MVVM) pattern (cont.) static Process.GetProcessById() method, 629 implementation System.AppDomain Class, 636 Button Command binding System.Diagnostics namespace, 626 statements, 1376 system.diagnostics.process, 627 data source, 1374 Nongeneric collections ObjectMaterialized event, 1380 issue of performance, 320 Module-level attributes, 585 issue of type safety, 323 Monitor.Enter() method, 722 Multitabled DataSet objects and data relationships building table relationships, 899 „„ O displaying data, 896–897 Object generations, 479 navigating between related tables, 900 Object lifetime Button’s Click event handler, 900–901 application roots, 477 output when specifying customer ID, 901 CIL newobj instruction, 475 UI for customer order information, 900 classes, objects, and references, 473 preparation, 897 concurrent background garbage preparing data, 897–898 collection, 480 updating database tables, 899 concurrent garbage collection, 480 Multithreaded application disposable objects, 488 AutoResetEvent class, 715 finalizable and disposable types, 492 background threads, 716 finalizable objects foreground threads, 716–717 finalization process, 488 OS/CLR, 697 Overriding System.Object.Finalize(), 486 ParameterizedThreadStart delegate, 714 lazy object instantiation, 495 synchronization, 697 MakeACar() method, 475 attribute, 724 object generations, 479 C# lock keyword, 719 setting object references to null, 477 System.Threading.Interlocked Type, 723 System.GC Type System.Threading.Monitor class, 722 garbage collection, 482 synchronizing threads, 718 member selection, 481 System.Threading namespace, 696 Object-oriented programming (OOP), 175 ThreadStart Delegate, 712 Draw() method, 178 MyLocalVariables() method, 675 encapsulation, role of, 175 “has-a” relationship, 176 inheritance „„ N controlling base class, 213 nameof method, 1338 Employee.cs and Employee.Core.cs NarrowingAttempt() method, 94 files, 212 .NET delegate, 697 Manager class, 212 .NET platform protected keyword, 215 context-agile and context-bound SalesPerson class, 212 types, 646 sealed class, 216 context-bound object, 647 inheritance, role of, 175 new application domains “is-a” relationship, 175 custom application domains, 643 polymorphic programmatically unloading abstract classes, 225 AppDomains, 644 abstract methods, 230 object’s context inspection, 647 Draw() method, 230 process’s module set, 632 GiveBonus(), 220 process’s thread set, 630 Main() method, 231 programmatically launch and terminate sealing virtual members, 225 process, 633 shadowing, 232 running processes, 628 shapes hierarchy, 228 Start() method, 634 virtual and abstract methods, 228

1618 ■ Index

virtual and override keywords, 221 „„ P Visual Studio IDE, 223 polymorphism, 177 Parallel.ForEach() method, 728 ObjectResourcesApp, 1295 Parallel.For() method, 728 Object Serialization Parallel.Invoke() method, 738 customize serialization process, 796 Parallel LINQ Queries (PLINQ), 695 Formatter AsParallel() extension method, 739 BinaryFormatter type, 781, 783 cancellation, 740 Deserialize() method, 782 nonparallel version, 739 IFormatter type, 781 ParallelEnumerable Class, 738 IRemotingFormatter interfaces, 781 Parallel programming Person type, 783 CancellationTokenSource class, 733 Serialize() method, 782 data parallelism, 729 SoapFormatter type, 781, 786 System.Threading.Tasks type fidelity, 782 namespace, 728 XmlSerializer type, 781, 787 System.Threading.Tasks.Parallel class, 728 GetObjectData() method, 793 Task class, 732 ISerializable interface, 793–794 task parallelism, 735 ISerializable object, 793 Task Parallel Library (TPL), 727 MyStringData, 795 thread affinity, 731 object graph, 778 ParseFromStrings()method, 81 Object set, 790 PartialView() method, 1563–1564 private fields, 780 plain old CLR objects (POCOs), 1527 public fields, 780 Polymorphism, 177 public properties, 780 PopulateDocument() method, 1203 Serializable Types, 779 PostAsJsonAsync() extension method, 1597 SerializationInfo parameter, 793 PostInventory() method, 1593 StreamingContextStates enumeration, 794 Pre-WPF solutions, 1086 string data, 794 PrintDataSet() method, 872 System.Object, 790 PrintNumbers() method, 717–718 System.Runtime.Serialization namespace, 792 PrintTime() method, 725 UserPrefs class, 776 ProcessCreditRisk() method, 855 Observable models ProcessFiles() method, 731, 733 collections ProcessIntData() method, 740 dirty flag, 1345 PutInventory() method, 1592 IList (see InventoryList) Inventory class, 1333 „„ Q MainWindow.xaml.cs, 1344 Notifications, 1332 Queued Components (QC), 1023 NotifyCollectionChangedAction enum Queuing data, 1023 Values, 1339 NotifyCollectionChangedEventArgs „„ R Constructor Options, 1339 UpdateSourceTrigger values, 1347 Read() method, 835, 841 INotifyPropertyChanged event, 1337 RegisterWithCarEngine() method, 365–366 INotifyPropertyChanged interface, 1336 Remove() method, 368 OnPropertyChanged helper method, 1337 RemoveAt method, 1343 PropertyChangedEventArgs constructor, 1336 remove_Exploded() method, 377 Ok() method, 1592 RenderTransform property, 1249 OnCarEngineEvent() method, 366 ResetPoint() method, 349 OnPropertyChanged helper method, 1337 Retained-mode graphics, 1229 OnStart() method, 1067 ReverseDigits(), 419 OnStop() method, 1067 Rollback() method, 854 OnTransformDirty() method, 1220 RouteConfig, 1538 OpenConnection() method, 838 RowState property, 868

1619 ■ index

„„ S catch statements, 268 compile-time errors, 267 SaveAs method, 1422 constructors, 251–252 Select() method, 883 containment/delegation, 251 Serviced component, 1023 data property, 258–260 Service-oriented architecture (SOA), 1027 debugging, 272–273 Session data definitions, 247 HttpSessionState class, 1513 filters, 271 session application GUI, 1512 HelpLink property, 257–258 Session_End(), 1510 inner exceptions, 269–270 Session_Start(), 1510 Main() method, 252–253 UserShoppingCart, 1511 .NET SetBinding() method, 1218 building blocks, 249 SetBindings() function, 1215 C code, 248 SetF1CommandBinding() method, 1178 E_FILENOTFOUND constant, 248 SetValue() method, 1219 System.Exception base class, 249–250 ShowDialog() method, 1149 WCF service, 249 ShowEnvironmentDetails()method, 67 Radio type, 251 ShowInstructions() method, 849 rethrowing exceptions, 268–269 SimpleBoxUnboxOperation() method, 320 StackTrace property, 257 Simple Object Access Protocol (SOAP), 786 system exceptions, 260 SoapFormatter type, 781 TargetSite property, 256 ref tokens, 786 try/catch block, 254–255, 270–271 System.Runtime.Serialization.Formatters. verbose error dump, 254 Soap.dll, 786 Subtract() methods, 362 SortCars() function, 1560 *.svc file, 1079 SqlCommandBuilder, 892–893 svcutil.exe, 1050 SquareNumber() method, 361 System.Collections.Generic Static method, 362 Classes, 332 static Thread.GetDomain() method, 696 Dictionary type, 340 static Thread.Sleep() method, 699 initialization syntax, 333 StringConcatenation() function, 85 Key Interfaces, 332 String.Format() method, 73 List class, 334 StringTarget() method, 372 Queue Type, 337 Strongly typed Data Adapter, 913–914 SortedSet class, 338 Strongly typed DataRow, 912 Stack class, 336 Strongly typed DataSet, 909–910 System.Collections.ObjectModel custom aspects of AutoLot, 916 members, 341 deleting data with generated code, 920 ObservableCollection class, 341 inserting data with generated code, 919–920 System.Console Class inserting into new folder, 915 formatting invoking stored procedure, 921 Console.WriteLine(), 71 selecting data with generated code, 918–919 numerical data, 71 viewing generated code, 916–917 string.Format() method, 73 Strongly typed DataTable, 911 input and output, 69 Structured exception handling members, 69 Accelerate() method, 253 System.EnterpriseServices, 1023 application-level exceptions, 261 System.Environment Class attributes/object serialization, 264 properties, 68 CarIsDeadException, 262–263 ShowEnvironmentDetails()method, 67 code snippet template, 264–265 System.IO.Stream class, 764 custom exception, 261 System.Messaging, 1023 prim-and-proper custom exception class, 264 System.Reflection, 1317 ArgumentOutOfRangeException, 265 System.Runtime.Remoting, 1024 catch logic, 266 System.Threading Namespace

1620 ■ Index

CLR thread pool, 726 INotifyDataErrorInfo interface core types, 708 additional features, 1358 current thread execution, 709 CheckMakeAndColor helper Name property, 710 method, 1358 Priority property, 711 code implementation, 1355 Thread Type errors collection, 1361 Instance-Level Members, 709 GetErrors method, 1359 Static Members, 708 InventoryPartial.cs class, 1361, 1363 TimerCallback delegate, 725 ModelT validation, 1357 System.Web Namespace, 1499 System.Collections and System. System.Windows.Markup, 1317 ComponentModel, 1361 System.Xml, 1317 ValidationError object, 1360 System.Xml.dll assembly, 1001 Label and TextBox, 1348 Validation controls, 1470 client-side form validation, 1470 „„ T client-side JavaScript validation support, 1472 Task Parallel Library (TPL), 695, 697, 727 CompareValidator, 1473 Themes data annotations App_Theme folder, 1482 app testing, 1481 assigning, 1486 code, 1480 CssStyle property, 1482 EditItemTemplate, 1478–1479 page-by-page level, 1485 FormView control, 1478 property settings, 1482 InsertItemTemplate, 1479 selection, 1486 Inventory class, 1477 site-wide themes, 1485 Inventory.cs class, 1477 *.skin files, 1482 ItemTemplate, 1478 SkinID property, 1486 ModelErrorMessage control, 1477 style sheets, 1482 layout, 1471 ThreadPool.QueueUserWorkItem() properties, 1470 method, 726 RangeValidator, 1473 Thread.Sleep() method, 698 RegularExpressionValidator, 1472 Thread.Start() method, 716 RequiredFieldValidator, 1472 TimerCallback delegate, 725 ValidationGroups.aspx, 1476 ToArray() extension method, 461 ValidationSummary widget, 1474 ToolsSpellingHints_Click() method, 1175 ValidatorCtrls web site, 1471 TreesAndTemplatesApp, 1313 ValueAndReferenceTypes() method, 137 TryFindResource() method, 1311 Vector images TryUpdateModel, 1462 importing graphical data, 1265–1266 interacting with sign, 1266–1267 sample vector graphic file to XAML conversion „„ U folder hierarchy, 1264 Update() methods, 810 printing, 1263–1264 UpdateCarPetName() method, 851 rendered image, 1265 UpdateInventory(), 894 using Inkscape, 1262–1263 Update() method, 1588 Verbatim string, 87 View() method, 1551 Virtual execution stack, 655 „„ V Virtual member, 177 ValidateCurrentNumber method, 1225 Visual layer ValidateInput() method, 1422 DrawingVisual Class, 1269–1270 Validation rendering to custom layout manager, 1271–1273 CardId, 1349 responding to hit-test operations, 1273–1274 class, 1349 Visual Base class and derived Child ErrorTemplate property, 1351 classes, 1268 IDataErrorInfo interface, 1351 Visual Studio, 1388, 1390

1621 ■ index

Visual Studio transform editor C# code, 1440 applying transformations at design data-centric controls, 1446 time, 1256–1257 documentation, 1448 building initial layout, 1254–1255 dynamic controls transforming Canvas in code, 1257 btnGetTextData button, 1442 enumeration, 1441 lblTextBoxData, 1442 „„ W text boxes, 1442–1443 WCFWindows Communication Foundation (WCF) WebControl base class, 1443 WcfTestClient.exe, 1030 web page, 1439 Web API project HTML description, 1438 AutoLotDAL project, 1585 Label control, 1440 AutoLotEntities variable remove, 1594 tag, 1435 AutoMapper, 1584 server-side