An Encrypted String Data Type for Visual Studio LightSwitch: Listing 1

Updated BlankPresentation.lsml file.

<?xml version="1.0" encoding="utf-8" ?>
<ModelFragment
  xmlns="http://schemas.microsoft.com/LightSwitch/2010/xaml/model"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <Control
    Name="EncryptedStringControl"
    SupportedContentItemKind="Value"
    DesignerImageResource="Microsoft.LightSwitch.DesignerImages::TextBox">
    <Control.Attributes>
      <DisplayName Value="$(EncryptedStringControl_DisplayName)" />
    </Control.Attributes>
    <Control.SupportedDataTypes>
      <SupportedDataType DataType="EncryptedString"/>
    </Control.SupportedDataTypes>
  </Control>

  <DefaultViewMapping
    ContentItemKind="Value"
    DataType="EncryptedString"
    View="EncryptedStringControl"/>

  <!-- EncryptedString Semantic Type -->
  <SemanticType Name="EncryptedString" UnderlyingType=":String">
    <SemanticType.Attributes>
      <Attribute Class="@EncryptedStringValidation" />
    </SemanticType.Attributes>
  </SemanticType>

  <AttributeClass Name="EncryptedStringValidation">
    <AttributeClass.Attributes>
      <Validator />
      <SupportedType Type="EncryptedString?" />
    </AttributeClass.Attributes>
  </AttributeClass>
  
</ModelFragment>

About the Author

Joe Kunk is a Microsoft MVP in Visual Basic, three-time president of the Greater Lansing User Group for .NET, and developer for Dart Container Corporation of Mason, Michigan. He's been developing software for over 30 years and has worked in the education, government, financial and manufacturing industries. Kunk's co-authored the book "Professional DevExpress ASP.NET Controls" (Wrox Programmer to Programmer, 2009). He can be reached via email at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube