Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions snippets/csharp/System.Data.Linq/TableAttribute/Overview/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace cs_maketables
{
class Program
{
static void Main(string[] args)
{
}
}

// <Snippet1>
[Table(Name = "Customers")]
public class Customer
{
// ...
}
// </Snippet1>

// <Snippet2>
[Table(Name = "Customers")]
public class customer
{
[Column(Name = "CustomerID")]
public string CustomerID;
// ...
}
// </Snippet2>
}

// <Snippet3>
[Table(Name = "Customers")]
public partial class Customer
{
[Column(IsPrimaryKey = true)]
public string CustomerID;
// ...
private EntitySet<Order> _Orders;
[Association(Storage = "_Orders", OtherKey = "CustomerID")]
public EntitySet<Order> Orders
{
get { return this._Orders; }
set { this._Orders.Assign(value); }
}
}
// </Snippet3>

// <Snippet4>
[Table]
[InheritanceMapping(Code = "C", Type = typeof(Car))]
[InheritanceMapping(Code = "T", Type = typeof(Truck))]
[InheritanceMapping(Code = "V", Type = typeof(Vehicle),
IsDefault = true)]
public class Vehicle
{
[Column(IsDiscriminator = true)]
public string DiscKey;
[Column(IsPrimaryKey = true)]
public string VIN;
[Column]
public string MfgPlant;
}
public class Car : Vehicle
{
[Column]
public int TrimCode;
[Column]
public string ModelName;
}

public class Truck : Vehicle
{
[Column]
public int Tonnage;
[Column]
public int Axles;
}
// </Snippet4>

// <Snippet5>
[Table(Name = "Orders")]
public class Order
{
[Column(IsPrimaryKey = true)]
public int OrderID;
[Column]
public string CustomerID;
private EntityRef<Customer> _Customer;
[Association(Storage = "_Customer", ThisKey = "CustomerID")]
public Customer Customer
{
get { return this._Customer.Entity; }
set { this._Customer.Entity = value; }
}
}
// </Snippet5>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Reference Include="System.Data.Linq" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
Imports System.Data.Linq
Imports System.Data.Linq.Mapping

Module Module1
Sub Main()

End Sub

End Module

' <Snippet1>
<Table(Name:="Customers")>
Public Class Customer
' ...
End Class
' </Snippet1>

Namespace ns

' <Snippet2>
<Table(Name:="Customers")>
Public Class Customer
<Column(Name:="CustomerID")>
Public CustomerID As String
' ...
End Class
' </Snippet2>

End Namespace

Namespace ns2

' <Snippet3>
<Table(Name:="Customers")>
Public Class Customer
<Column(IsPrimaryKey:=True)>
Public CustomerID As String
' ...
Private _orders As EntitySet(Of Order)
<Association(Storage:="_Orders", OtherKey:="CustomerID")>
Public Property Orders() As EntitySet(Of Order)
Get
Return _orders
End Get
Set(ByVal value As EntitySet(Of Order))
_orders.Assign(value)
End Set
End Property
End Class
' </Snippet3>

' <Snippet4>
<Table()>
<InheritanceMapping(Code:="C", Type:=GetType(Car))>
<InheritanceMapping(Code:="T", Type:=GetType(Truck))>
<InheritanceMapping(Code:="V", Type:=GetType(Vehicle),
IsDefault:=True)>
Public Class Vehicle
<Column(IsDiscriminator:=True)>
Private _discKey As String
<Column(IsPrimaryKey:=True)>
Private _vIN As String
<Column()>
Private _mfgPlant As String
End Class

Public Class Car
Inherits Vehicle
<Column()>
Private _trimCode As Integer
<Column()>
Private _modelName As String
End Class

Public Class Truck
Inherits Vehicle
<Column()>
Private _tonnage As Integer
<Column()>
Private _axles As Integer
End Class
' </Snippet4>

' <Snippet5>
<Table(Name:="Orders")>
Public Class Order
<Column(IsPrimaryKey:=True)>
Public OrderID As Integer
<Column()>
Public CustomerID As String
Private _customer As EntityRef(Of Customer)
<Association(Storage:="Customer", ThisKey:="CustomerID")>
Public Property Customer() As Customer
Get
Return _customer.Entity
End Get
Set(ByVal value As Customer)
_customer.Entity = value
End Set
End Property
End Class
' </Snippet5>

End Namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Reference Include="System.Data.Linq" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion xml/Microsoft.CSharp/CSharpCodeProvider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ In .NET Framework apps, you can obtain the value for `providerOptions` from the
<altmember cref="T:System.CodeDom.Compiler.CodeDomProvider" />
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/">Configuration file schema for the .NET Framework</related>
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/compiler/compilers-element">&lt;compilers&gt; Element</related>
<related type="Article" href="/dotnet/framework/reflection-and-codedom/specifying-fully-qualified-type-names">Specifying Fully Qualified Type Names</related>
<related type="Article" href="/dotnet/fundamentals/reflection/specifying-fully-qualified-type-names">Specifying Fully Qualified Type Names</related>
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/compiler/provideroption-element">&lt;provideroption&gt; Element</related>
</Docs>
</Member>
Expand Down
48 changes: 24 additions & 24 deletions xml/Microsoft.CSharp/Compiler.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,29 @@ For the `options` parameter, the key is the short form of the compiler option. T

| Key Name | Usage |
| --- | --- |
| `addmodule` | List of modules to include in this assembly. The module names must be separated by the vertical bar or pipe character. Value must be of type <xref:System.String>. See [-addmodule (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/addmodule-compiler-option). |
| `baseaddress` | Base address for libraries. Value must be of type <xref:System.UInt32>. See [-baseaddress (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/baseaddress-compiler-option). |
| `bugreport` | Produces bug report file. Value must be of type <xref:System.String>. See [-bugreport (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/bugreport-compiler-option). |
| `checked` | Set default expression evaluation to checked (or unchecked). Value must be of type <xref:System.Boolean>. See [-checked (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/checked-compiler-option). |
| `d` | List of semicolon separated symbols to define. Value must be of type <xref:System.String>. See [-define (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/define-compiler-option). |
| `debug` | Emit debug information with output. Value must be of type <xref:System.Boolean>. Full or pdb-only cannot be specified. See [-debug (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/debug-compiler-option). |
| `doc` | File name to put XML comments in. Value must be of type <xref:System.String>. See [-doc (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/doc-compiler-option). |
| `filealign` | PE section alignment size. Value must be of type <xref:System.UInt32>. See [-filealign (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/filealign-compiler-option). |
| `addmodule` | List of modules to include in this assembly. The module names must be separated by the vertical bar or pipe character. Value must be of type <xref:System.String>. See [-addmodule (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/inputs). |
| `baseaddress` | Base address for libraries. Value must be of type <xref:System.UInt32>. See [-baseaddress (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/advanced). |
| `bugreport` | Produces bug report file. Value must be of type <xref:System.String>. See [-bugreport (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/). |
| `checked` | Set default expression evaluation to checked (or unchecked). Value must be of type <xref:System.Boolean>. See [-checked (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/language). |
| `d` | List of semicolon separated symbols to define. Value must be of type <xref:System.String>. See [-define (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/language). |
| `debug` | Emit debug information with output. Value must be of type <xref:System.Boolean>. Full or pdb-only cannot be specified. See [-debug (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/code-generation). |
| `doc` | File name to put XML comments in. Value must be of type <xref:System.String>. See [-doc (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/output). |
| `filealign` | PE section alignment size. Value must be of type <xref:System.UInt32>. See [-filealign (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/advanced). |
| `incr` | Enable incremental rebuild. Value must be of type <xref:System.Boolean>. |
| `lib` | Additional paths to search when locating modules and referenced assemblies. Value must be of type <xref:System.String>. See [-lib (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/lib-compiler-option). |
| `linkres` | Link a managed resource to the assembly. Value must be of type <xref:System.String>. See [-linkresource (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/linkresource-compiler-option). |
| `m` | Type to search in for the Main method. Value must be of type <xref:System.String>. See [-main (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/main-compiler-option). |
| `nostdlib` | Do not auto-reference mscorlib.dll. Value must be of type <xref:System.Boolean>. See [-nostdlib (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/nostdlib-compiler-option). |
| `nowarn` | List of semicolon separated warning numbers to not report. Value must be of type <xref:System.String>. See [-nowarn (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/nowarn-compiler-option). |
| `o` | Enable compiler optimizations. Value must be of type <xref:System.Boolean>. See [-optimize (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/optimize-compiler-option). |
| `r` | Referenced assemblies. Value must be of type String. If more than one assembly is specified, the file name must be separated by the vertical bar or pipe character. See [-reference (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/reference-compiler-option). |
| `res` | Embed a managed resource. Value must be of type <xref:System.String>. See [-resource (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/resource-compiler-option). |
| `target` | Output file target type, one of the following: "library", "exe", "winexe", or "module". Value must be of type <xref:System.String>. See [-target (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/target-compiler-option). |
| `unsafe` | Allow unsafe constructs. Value must be of type <xref:System.Boolean>. See [-unsafe (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/unsafe-compiler-option). |
| `w` | Warning level (0-4). Value must be of type <xref:System.String>. See [-warn (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/warn-compiler-option). |
| `warnaserror` | Report warning diagnostics as errors. Value must be of type <xref:System.Boolean>. See [-warnaserror (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/warnaserror-compiler-option). |
| `win32icon` | Win32 icon for auto generated Win32 resource. Value must be of type <xref:System.String>. See [-win32icon (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/win32icon-compiler-option). |
| `win32res` | Win32 resource file. Value must be of type <xref:System.String>. See [-win32res (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/win32res-compiler-option). |
| `lib` | Additional paths to search when locating modules and referenced assemblies. Value must be of type <xref:System.String>. See [-lib (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/advanced). |
| `linkres` | Link a managed resource to the assembly. Value must be of type <xref:System.String>. See [-linkresource (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/resources). |
| `m` | Type to search in for the Main method. Value must be of type <xref:System.String>. See [-main (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/advanced). |
| `nostdlib` | Do not auto-reference mscorlib.dll. Value must be of type <xref:System.Boolean>. See [-nostdlib (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/advanced). |
| `nowarn` | List of semicolon separated warning numbers to not report. Value must be of type <xref:System.String>. See [-nowarn (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/errors-warnings). |
| `o` | Enable compiler optimizations. Value must be of type <xref:System.Boolean>. See [-optimize (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/code-generation). |
| `r` | Referenced assemblies. Value must be of type String. If more than one assembly is specified, the file name must be separated by the vertical bar or pipe character. See [-reference (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/inputs). |
| `res` | Embed a managed resource. Value must be of type <xref:System.String>. See [-resource (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/resources). |
| `target` | Output file target type, one of the following: "library", "exe", "winexe", or "module". Value must be of type <xref:System.String>. See [-target (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/output). |
| `unsafe` | Allow unsafe constructs. Value must be of type <xref:System.Boolean>. See [-unsafe (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/language). |
| `w` | Warning level (0-4). Value must be of type <xref:System.String>. See [-warn (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/errors-warnings). |
| `warnaserror` | Report warning diagnostics as errors. Value must be of type <xref:System.Boolean>. See [-warnaserror (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/errors-warnings). |
| `win32icon` | Win32 icon for auto generated Win32 resource. Value must be of type <xref:System.String>. See [-win32icon (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/resources). |
| `win32res` | Win32 resource file. Value must be of type <xref:System.String>. See [-win32res (C# Compiler Options)](/dotnet/csharp/language-reference/compiler-options/resources). |

]]></format>
</remarks>
Expand All @@ -124,8 +124,8 @@ For the `options` parameter, the key is the short form of the compiler option. T

<paramref name="sourceTextNames" /> is not the same size as <paramref name="sourceTexts" />.
</exception>
<related type="Article" href="/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-line">#line (C# Reference)</related>
<related type="Article" href="/dotnet/csharp/language-reference/compiler-options/reference-compiler-option">-reference (C# Compiler Options)</related>
<related type="Article" href="/dotnet/csharp/language-reference/preprocessor-directives">#line (C# Reference)</related>
<related type="Article" href="/dotnet/csharp/language-reference/compiler-options/inputs">-reference (C# Compiler Options)</related>
<related type="Article" href="/dotnet/csharp/language-reference/compiler-options/">C# Compiler Options</related>
</Docs>
</Member>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
The value of this field is always `false` if this <xref:System.AddIn.Contract.Automation.RemoteParameterData> describes a parameter of a method provided by a COM object.
Parameters that can have a variable number of arguments are specified by the `params` (for Visual C#) and `ParamArray` (for Visual Basic) keywords. For more information, see [params](/dotnet/csharp/language-reference/keywords/params) and [ParamArray](/dotnet/visual-basic/language-reference/modifiers/paramarray).
Parameters that can have a variable number of arguments are specified by the `params` (for Visual C#) and `ParamArray` (for Visual Basic) keywords. For more information, see [params](/dotnet/csharp/language-reference/keywords/method-parameters) and [ParamArray](/dotnet/visual-basic/language-reference/modifiers/paramarray).
]]></format>
</remarks>
Expand Down
2 changes: 1 addition & 1 deletion xml/System.CodeDom.Compiler/CodeCompiler.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<xref:System.CodeDom.Compiler.CodeCompiler> is a useful utility base class for code generators to derive from in order to provide code compilation functions.
> [!NOTE]
> This class contains a link demand and an inheritance demand at the class level that applies to all members. A <xref:System.Security.SecurityException> is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see [Link Demands](/dotnet/framework/misc/link-demands).
> This class contains a link demand and an inheritance demand at the class level that applies to all members. A <xref:System.Security.SecurityException> is thrown when either the immediate caller or the derived class does not have full-trust permission.
]]></format>
</remarks>
Expand Down
2 changes: 1 addition & 1 deletion xml/System.CodeDom.Compiler/CodeDomProvider.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
For more details on language provider settings in the configuration file, see [Compiler and Language Provider Settings Schema](/dotnet/framework/configure-apps/file-schema/compiler/).
> [!NOTE]
> This class makes a link demand and an inheritance demand at the class level. A <xref:System.Security.SecurityException> is thrown if either the immediate caller or the derived class does not have full trust permission. For details about security demands, see [Link Demands](/dotnet/framework/misc/link-demands).
> This class makes a link demand and an inheritance demand at the class level. A <xref:System.Security.SecurityException> is thrown if either the immediate caller or the derived class does not have full trust permission.
Expand Down
2 changes: 1 addition & 1 deletion xml/System.CodeDom.Compiler/CodeGenerator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
This is a useful base class for code generators to derive from. Code generators are capable of rendering source code in a specific language according to the structure of a Code Document Object Model (CodeDOM) graph. This class provides many functions and methods to generate specific types of code from a CodeDOM graph.

> [!NOTE]
> This class contains a link demand and an inheritance demand at the class level that applies to all members. A <xref:System.Security.SecurityException> is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see [Link Demands](/dotnet/framework/misc/link-demands).
> This class contains a link demand and an inheritance demand at the class level that applies to all members. A <xref:System.Security.SecurityException> is thrown when either the immediate caller or the derived class does not have full-trust permission.

]]></format>
</remarks>
Expand Down
Loading
Loading