[c# gbc] Add support to generate constructors with parameters

This provides a codegen supported way to construct and initialize C#
classes generated with the --preview-readonly-properties option.

Closes https://github.com/Microsoft/bond/pull/857
This commit is contained in:
Bertus Greeff 2018-05-09 16:34:45 -07:00 коммит произвёл Christopher Warrington
Родитель 155d2393bd
Коммит 6f028f08dd
20 изменённых файлов: 1712 добавлений и 31 удалений

Просмотреть файл

@ -122,6 +122,11 @@ different versioning scheme, following the Haskell community's
* Fixed a bug in the codegen targets when using `gbc` from $PATH on macOS
and Linux that prevented the C# compiler from finding the generated C#
files.
* *Preview*: Added preliminary support for generating types with
constructors with parameters for each field. This functionality will
change in the future and may be removed. [Pull request
#857](https://github.com/Microsoft/bond/pull/857)
## 7.0.2: 2017-10-30 ##
* `gbc` & compiler library: 0.10.1.0

Просмотреть файл

@ -119,8 +119,11 @@ csCodegen options@Cs {..} = do
else if fields
then PublicFields
else Properties
constructorOptions = if constructor_parameters
then ConstructorParameters
else DefaultWithProtectedBase
templates = concat $ map snd $ filter fst codegen_templates
codegen_templates = [ (structs_enabled, [types_cs Class fieldMapping])
codegen_templates = [ (structs_enabled, [types_cs Class fieldMapping constructorOptions])
, (grpc_enabled, [grpc_cs])
]
csCodegen _ = error "csCodegen: impossible happened."

Просмотреть файл

@ -59,6 +59,7 @@ data Options
, structs_enabled :: Bool
, grpc_enabled :: Bool
, service_inheritance_enabled :: Bool
, constructor_parameters :: Bool
}
| Java
{ files :: [FilePath]
@ -110,6 +111,7 @@ cs = Cs
, fields = def &= name "f" &= help "Generate public fields rather than properties"
, structs_enabled = True &= explicit &= name "structs" &= help "Generate C# types for Bond structs and enums (true by default, use \"--structs=false\" to disable)"
, grpc_enabled = False &= explicit &= name "grpc" &= help "Generate C# services and proxies for gRPC"
, constructor_parameters = def &= explicit &= name "preview-constructor-parameters" &= help "PREVIEW FEATURE: Generate a constructor that takes all the fields as parameters. Typically used with readonly-properties."
} &=
name "c#" &=
help "Generate C# code"

Просмотреть файл

@ -7,12 +7,13 @@ module Language.Bond.Codegen.Cs.Types_cs
( types_cs
, FieldMapping(..)
, StructMapping(..)
, ConstructorOptions(..)
) where
import Data.Monoid
import qualified Data.Foldable as F
import Prelude
import Data.Text.Lazy (Text)
import Data.Text.Lazy (Text, pack)
import Text.Shakespeare.Text
import Language.Bond.Syntax.Types
import Language.Bond.Syntax.Util
@ -34,12 +35,19 @@ data FieldMapping =
ReadOnlyProperties -- ^ auto-properties with private setter
deriving Eq
-- | Options for how constructors should be generated.
data ConstructorOptions =
DefaultWithProtectedBase | -- ^ The original bond behavior.
ConstructorParameters -- ^ Generate a constructor that takes all the fields as parameters.
deriving Eq
-- | Codegen template for generating definitions of C# types representing the schema.
types_cs
:: StructMapping -- ^ Specifies how to represent schema structs
-> FieldMapping -- ^ Specifies how to represent schema fields
-> ConstructorOptions -- ^ Specifies the constructors that should be generated
-> MappingContext -> String -> [Import] -> [Declaration] -> (String, Text)
types_cs structMapping fieldMapping cs _ _ declarations = (fileSuffix, [lt|
types_cs structMapping fieldMapping constructorOptions cs _ _ declarations = (fileSuffix, [lt|
#{CS.disableCscWarnings}
#{CS.disableReSharperWarnings}
namespace #{csNamespace}
@ -71,6 +79,9 @@ namespace #{csNamespace}
propertyAttributes f = case structMapping of
Class -> CS.propertyAttributes cs f
baseClass x = [lt|
: #{csType x}|]
-- C# type definition for schema struct
typeDefinition s@Struct {..} = [lt|#{typeAttributes s}#{struct}#{declName}#{params}#{maybe interface baseClass structBase}#{constraints}
{
@ -86,20 +97,15 @@ namespace #{csNamespace}
-- constraints
constraints = CS.paramConstraints declParams
-- base
callBaseCtor = getAny $ optional (foldMapFields metaField) structBase
baseClass x = [lt|
: #{csType x}|]
baseCtor = if not callBaseCtor then mempty else [lt|
: base(fullName, name)|]
-- default value
csDefault = CS.defaultValue cs
-- constructors
constructors = if noCtor then mempty else [lt|
metaFields = filter (isMetaName . fieldType) structFields
noMetaFields = null metaFields
-- constructor: DefaultWithProtectedBase option
defaultWithProtectedBaseConstructor = if noCtor then mempty else [lt|
public #{declName}()
: this("#{getDeclTypeName idl s}", "#{declName}")
@ -111,7 +117,65 @@ namespace #{csNamespace}
}|]
where
noCtor = not callBaseCtor && (fieldMapping == PublicFields && noMetaFields || null structFields)
noMetaFields = not $ getAny $ F.foldMap metaField structFields
callBaseCtor = getAny $ optional (foldMapFields metaField) structBase
baseCtor = if not callBaseCtor
then mempty
else [lt|
: base(fullName, name)|]
-- constructor: ConstructorParameters option
constructorWithParameters = if not noMetaFields
then error $ "bond_meta usage in Struct " ++ (show declName) ++ " Field " ++ (show $ fieldName $ head metaFields) ++ " is incompatible with --preview--constructor-parameters"
else if (null baseFieldList)
then [lt|
public #{declName}(
#{commaLineSep 3 paramDecl fieldNameList})
{
#{newlineSep 3 paramBasedInitializer fieldNameList}
}
public #{declName}()
{
#{newlineSep 3 initializer structFields}
}|]
else [lt|
public #{declName}(
// Base class parameters
#{commaLineSep 3 paramDecl (zip baseFieldList uniqueBaseFieldNames)}#{thisParamBlock}
) : base(
#{commaLineSep 4 pack uniqueBaseFieldNames})
{
#{newlineSep 3 paramBasedInitializer (zip structFields uniqueThisFieldNames)}
}
public #{declName}()
{
#{newlineSep 3 initializer structFields}
}|]
thisParamBlock = if null structFields
then mempty
else [lt|,
// This class parameters
#{commaLineSep 3 paramDecl (zip structFields uniqueThisFieldNames)}|]
baseFieldList = concat $ baseFields s
uniqueBaseFieldNames = uniqueNames (map fieldName baseFieldList) []
uniqueThisFieldNames = uniqueNames (map fieldName structFields) uniqueBaseFieldNames
paramDecl (f, n) = [lt|#{csType $ fieldType f} #{n}|]
paramBasedInitializer (f, n) = [lt|this.#{fieldName f} = #{n};|]
fieldNameList = map (\f -> (f, fieldName f)) structFields
constructors = case constructorOptions of
DefaultWithProtectedBase -> defaultWithProtectedBaseConstructor
ConstructorParameters -> constructorWithParameters
-- property or field
property f@Field {..} =

Просмотреть файл

@ -46,6 +46,7 @@ module Language.Bond.Codegen.Templates
-- ** C#
, FieldMapping(..)
, StructMapping(..)
, ConstructorOptions(..)
, types_cs
, grpc_cs
-- ** Java

Просмотреть файл

@ -25,6 +25,7 @@ module Language.Bond.Codegen.Util
, doubleLineSep
, doubleLineSepEnd
, uniqueName
, uniqueNames
, indent
, newLine
) where
@ -112,7 +113,7 @@ commonHeader c input output = [lt|
|]
-- | Given an intended name and a list of already taken names, returns a
-- unique name. Assumes that it's legal to appen digits to the end of the
-- unique name. Assumes that it's legal to append digits to the end of the
-- intended name.
uniqueName :: String -> [String] -> String
uniqueName baseName taken = go baseName (0::Integer)
@ -120,3 +121,13 @@ uniqueName baseName taken = go baseName (0::Integer)
| not (name `elem` taken) = name
| otherwise = go newName (counter + 1)
where newName = baseName ++ (show counter)
-- | Given a list of names with duplicates and a list of reserved names,
-- create a list of unique names using the uniqueName function.
uniqueNames :: [String] -> [String] -> [String]
uniqueNames names reserved = reverse $ go names [] reserved
where
go [] uniqueNames _ = uniqueNames
go (name:remaining) uniqueNames reserved = go remaining (newName:uniqueNames) (newName:reserved)
where
newName = uniqueName name reserved

Просмотреть файл

@ -84,7 +84,7 @@ processImport (Import file) = do
declaration :: Parser Declaration
declaration = do
-- When adding a new Declaration parser, order matters in the following command.
-- Parsers must fail to consume ANY token for the next parser to be able to succesfully work
-- Parsers must fail to consume ANY token for the next parser to be able to successfully work
-- unless the parser is encapsulated in a try statement. For more info on try and <|> see:
-- https://hackage.haskell.org/package/megaparsec-6.2.0/docs/Text-Megaparsec.html#v:try
decl <- try forward
@ -399,12 +399,12 @@ input = parens methodInputType
methodTypeVoid :: Parser MethodType
methodTypeVoid = try (keyword "void" *> pure Void) <?> "void method type"
-- Whether the method type is streaming or is unary can be determed based on
-- Whether the method type is streaming or is unary can be determined based on
-- context, but the context is different for result and input types.
--
-- For result types, the keyword stream followed by a struct name AND THEN
-- an identifier indicates a streaming type. Two identifiers are required to
-- distringuish between the unary method "stream stream()" and the streaming
-- distinguish between the unary method "stream stream()" and the streaming
-- method "stream stream stream()".
--
-- For input types, simply the keyword stream followed by a struct name is
@ -466,6 +466,6 @@ validDefaultType bondType (Just defaultValue) = validDefaultType' bondType defau
validDefaultType' _ _ = False
-- checks whether an Integer is within the bounds of some other Integral and Bounded type.
-- The value of the second paramater is never used: only its type is used.
-- The value of the second parameter is never used: only its type is used.
isInBounds :: forall a. (Integral a, Bounded a) => Integer -> a -> Bool
isInBounds value _ = value >= (toInteger (minBound :: a)) && value <= (toInteger (maxBound :: a))

Просмотреть файл

@ -10,6 +10,7 @@ module Language.Bond.Syntax.Internal
, takeNamespace
, isBaseField
, metaField
, baseFields
) where
import Data.Monoid
@ -51,3 +52,7 @@ metaField Field {..} = Any $ isMetaName fieldType
isBaseField :: String -> Maybe Type -> Bool
isBaseField name = getAny . optional (foldMapFields (Any.(name==).fieldName))
-- If a Declaration is a Struct then return the Fields of its Parent
baseFields :: Declaration -> Maybe [Field]
baseFields Struct{..} = foldMapFields return <$> structBase
baseFields _ = Nothing

Просмотреть файл

@ -156,6 +156,21 @@ tests = testGroup "Compiler tests"
, verifyCsCodegen "generics"
, verifyCsCodegen "inheritance"
, verifyCsCodegen "aliases"
, verifyCsCodegen "complex_inheritance"
, verifyCodegenVariation
[ "c#"
, "--preview-constructor-parameters"
, "--readonly-properties"
]
"complex_inheritance"
"constructor-parameters"
, verifyCodegenVariation
[ "c#"
, "--preview-constructor-parameters"
, "--fields"
]
"complex_inheritance"
"constructor-parameters_fields"
, verifyCodegen
[ "c#"
, "--using=time=System.DateTime"

Просмотреть файл

@ -6,6 +6,7 @@
module Tests.Codegen
( verifyCodegen
, verifyCodegenVariation
, verifyCppCodegen
, verifyCppGrpcCodegen
, verifyApplyCodegen
@ -47,7 +48,12 @@ verifyJavaCodegen = verifyCodegen ["java"]
verifyCodegen :: [String] -> FilePath -> TestTree
verifyCodegen args baseName =
testGroup baseName $
verifyFiles (processOptions args) baseName
verifyFiles (processOptions args) baseName ""
verifyCodegenVariation :: [String] -> FilePath -> FilePath -> TestTree
verifyCodegenVariation args baseName variation =
testGroup baseName $
verifyFiles (processOptions args) baseName variation
verifyApplyCodegen :: [String] -> FilePath -> TestTree
verifyApplyCodegen args baseName =
@ -97,7 +103,7 @@ verifyCsGrpcCodegen args baseName =
testGroup baseName $
map (verifyFile (processOptions args) baseName csTypeMapping "")
[ grpc_cs
, types_cs Class (fieldMapping (processOptions args))
, types_cs Class (fieldMapping (processOptions args)) (constructorOptions (processOptions args))
]
where
fieldMapping Cs {..} = if readonly_properties
@ -105,10 +111,13 @@ verifyCsGrpcCodegen args baseName =
else if fields
then PublicFields
else Properties
constructorOptions Cs {..} = if constructor_parameters
then ConstructorParameters
else DefaultWithProtectedBase
verifyFiles :: Options -> FilePath -> [TestTree]
verifyFiles options baseName =
map (verify (typeMapping options) "") (templates options)
verifyFiles :: Options -> FilePath -> FilePath -> [TestTree]
verifyFiles options baseName variation =
map (verify (typeMapping options) variation) (templates options)
<>
extra options
where
@ -118,6 +127,9 @@ verifyFiles options baseName =
else if fields
then PublicFields
else Properties
constructorOptions Cs {..} = if constructor_parameters
then ConstructorParameters
else DefaultWithProtectedBase
typeMapping Cpp {..} = cppExpandAliases type_aliases_enabled $ maybe cppTypeMapping (cppCustomAllocTypeMapping scoped_alloc_enabled) allocator
typeMapping Cs {} = csTypeMapping
typeMapping Java {} = javaTypeMapping
@ -128,32 +140,32 @@ verifyFiles options baseName =
] <>
[ enum_h | enum_header]
templates Cs {..} =
[ types_cs Class $ fieldMapping options
[ types_cs Class (fieldMapping options) (constructorOptions options)
]
templates Java {} =
[ javaCatTemplate
]
extra Cs {} =
[ testGroup "collection interfaces" $
map (verify csCollectionInterfacesTypeMapping "collection-interfaces") (templates options)
map (verify csCollectionInterfacesTypeMapping (variation </> "collection-interfaces")) (templates options)
]
extra Cpp {..} =
[ testGroup "custom allocator" $
map (verify (cppExpandAliasesTypeMapping $ cppCustomAllocTypeMapping False "arena") "allocator")
map (verify (cppExpandAliasesTypeMapping $ cppCustomAllocTypeMapping False "arena") (variation </> "allocator"))
(templates $ options { allocator = Just "arena" })
| isNothing allocator
] ++
[ testGroup "constructors with allocator argument" $
map (verify (cppExpandAliasesTypeMapping $ cppCustomAllocTypeMapping False "arena") "alloc_ctors")
map (verify (cppExpandAliasesTypeMapping $ cppCustomAllocTypeMapping False "arena") (variation </> "alloc_ctors"))
(templates $ options { allocator = Just "arena", alloc_ctors_enabled = True })
| isNothing allocator
] ++
[ testGroup "type aliases" $
map (verify (cppCustomAllocTypeMapping False "arena") "type_aliases")
map (verify (cppCustomAllocTypeMapping False "arena") (variation </> "type_aliases"))
(templates $ options { allocator = Just "arena", type_aliases_enabled = True })
] ++
[ testGroup "scoped allocator" $
map (verify (cppExpandAliasesTypeMapping $ cppCustomAllocTypeMapping True "arena") "scoped_allocator")
map (verify (cppExpandAliasesTypeMapping $ cppCustomAllocTypeMapping True "arena") (variation </> "scoped_allocator"))
(templates $ options { allocator = Just "arena", scoped_alloc_enabled = True })
| isNothing allocator
]

Просмотреть файл

@ -0,0 +1,142 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt { get; set; }
[global::Bond.Id(1)]
public int anotherInt { get; set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString { get; set; }
public Simple()
: this("Test.Simple", "Simple")
{}
protected Simple(string fullName, string name)
{
someString = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText { get; set; }
public Foo()
: this("Test.Foo", "Foo")
{}
protected Foo(string fullName, string name)
{
someText = "BaseText1";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum { get; set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; set; }
[global::Bond.Id(2)]
public int someInt { get; set; }
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText { get; set; }
[global::Bond.Id(4), global::Bond.Type(typeof(List<Simple>))]
public IList<Simple> someList { get; set; }
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public IDictionary<string, double> someMap { get; set; }
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public ISet<string> someSet { get; set; }
public Bar()
: this("Test.Bar", "Bar")
{}
protected Bar(string fullName, string name)
{
testEnum = TestEnum.Val2;
someText = "DerivedText1";
moreText = "";
someList = new List<Simple>();
someMap = new Dictionary<string, double>();
someSet = new HashSet<string>();
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText { get; set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText1 { get; set; }
public Baz()
: this("Test.Baz", "Baz")
{}
protected Baz(string fullName, string name)
{
someText = "";
evenMoreText = "";
someText1 = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
}
} // Test

Просмотреть файл

@ -0,0 +1,198 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt;
[global::Bond.Id(1)]
public int anotherInt;
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString = "";
public Simple(
int someInt,
int anotherInt,
string someString)
{
this.someInt = someInt;
this.anotherInt = anotherInt;
this.someString = someString;
}
public Simple()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText = "BaseText1";
public Foo(
string someText)
{
this.someText = someText;
}
public Foo()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum = TestEnum.Val2;
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText = "DerivedText1";
[global::Bond.Id(2)]
public int someInt;
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText = "";
[global::Bond.Id(4), global::Bond.Type(typeof(List<Simple>))]
public IList<Simple> someList = new List<Simple>();
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public IDictionary<string, double> someMap = new Dictionary<string, double>();
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public ISet<string> someSet = new HashSet<string>();
public Bar(
// Base class parameters
string someText,
// This class parameters
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet
) : base(
someText)
{
this.testEnum = testEnum;
this.someText = someText0;
this.someInt = someInt;
this.moreText = moreText;
this.someList = someList;
this.someMap = someMap;
this.someSet = someSet;
}
public Bar()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText = "";
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText = "";
public Baz(
// Base class parameters
string someText,
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet,
// This class parameters
string someText1,
string evenMoreText
) : base(
someText,
testEnum,
someText0,
someInt,
moreText,
someList,
someMap,
someSet)
{
this.someText = someText1;
this.evenMoreText = evenMoreText;
}
public Baz()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
public DerivedEmpty(
// Base class parameters
string someText
) : base(
someText)
{
}
public DerivedEmpty()
{
}
}
} // Test

Просмотреть файл

@ -0,0 +1,204 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt { get; private set; }
[global::Bond.Id(1)]
public int anotherInt { get; private set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString { get; private set; }
public Simple(
int someInt,
int anotherInt,
string someString)
{
this.someInt = someInt;
this.anotherInt = anotherInt;
this.someString = someString;
}
public Simple()
{
someString = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText { get; private set; }
public Foo(
string someText)
{
this.someText = someText;
}
public Foo()
{
someText = "BaseText1";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum { get; private set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; private set; }
[global::Bond.Id(2)]
public int someInt { get; private set; }
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText { get; private set; }
[global::Bond.Id(4), global::Bond.Type(typeof(List<Simple>))]
public IList<Simple> someList { get; private set; }
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public IDictionary<string, double> someMap { get; private set; }
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public ISet<string> someSet { get; private set; }
public Bar(
// Base class parameters
string someText,
// This class parameters
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet
) : base(
someText)
{
this.testEnum = testEnum;
this.someText = someText0;
this.someInt = someInt;
this.moreText = moreText;
this.someList = someList;
this.someMap = someMap;
this.someSet = someSet;
}
public Bar()
{
testEnum = TestEnum.Val2;
someText = "DerivedText1";
moreText = "";
someList = new List<Simple>();
someMap = new Dictionary<string, double>();
someSet = new HashSet<string>();
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; private set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText { get; private set; }
public Baz(
// Base class parameters
string someText,
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet,
// This class parameters
string someText1,
string evenMoreText
) : base(
someText,
testEnum,
someText0,
someInt,
moreText,
someList,
someMap,
someSet)
{
this.someText = someText1;
this.evenMoreText = evenMoreText;
}
public Baz()
{
someText = "";
evenMoreText = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
public DerivedEmpty(
// Base class parameters
string someText
) : base(
someText)
{
}
public DerivedEmpty()
{
}
}
} // Test

Просмотреть файл

@ -0,0 +1,142 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt { get; set; }
[global::Bond.Id(1)]
public int anotherInt { get; set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString { get; set; }
public Simple()
: this("Test.Simple", "Simple")
{}
protected Simple(string fullName, string name)
{
someString = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText { get; set; }
public Foo()
: this("Test.Foo", "Foo")
{}
protected Foo(string fullName, string name)
{
someText = "BaseText1";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum { get; set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; set; }
[global::Bond.Id(2)]
public int someInt { get; set; }
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText { get; set; }
[global::Bond.Id(4)]
public List<Simple> someList { get; set; }
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public Dictionary<string, double> someMap { get; set; }
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public HashSet<string> someSet { get; set; }
public Bar()
: this("Test.Bar", "Bar")
{}
protected Bar(string fullName, string name)
{
testEnum = TestEnum.Val2;
someText = "DerivedText1";
moreText = "";
someList = new List<Simple>();
someMap = new Dictionary<string, double>();
someSet = new HashSet<string>();
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText { get; set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText1 { get; set; }
public Baz()
: this("Test.Baz", "Baz")
{}
protected Baz(string fullName, string name)
{
someText = "";
evenMoreText = "";
someText1 = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
}
} // Test

Просмотреть файл

@ -0,0 +1,210 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt { get; private set; }
[global::Bond.Id(1)]
public int anotherInt { get; private set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString { get; private set; }
public Simple(
int someInt,
int anotherInt,
string someString)
{
this.someInt = someInt;
this.anotherInt = anotherInt;
this.someString = someString;
}
public Simple()
{
someString = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText { get; private set; }
public Foo(
string someText)
{
this.someText = someText;
}
public Foo()
{
someText = "BaseText1";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum { get; private set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; private set; }
[global::Bond.Id(2)]
public int someInt { get; private set; }
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText { get; private set; }
[global::Bond.Id(4), global::Bond.Type(typeof(List<Simple>))]
public IList<Simple> someList { get; private set; }
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public IDictionary<string, double> someMap { get; private set; }
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public ISet<string> someSet { get; private set; }
public Bar(
// Base class parameters
string someText,
// This class parameters
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet
) : base(
someText)
{
this.testEnum = testEnum;
this.someText = someText0;
this.someInt = someInt;
this.moreText = moreText;
this.someList = someList;
this.someMap = someMap;
this.someSet = someSet;
}
public Bar()
{
testEnum = TestEnum.Val2;
someText = "DerivedText1";
moreText = "";
someList = new List<Simple>();
someMap = new Dictionary<string, double>();
someSet = new HashSet<string>();
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; private set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText { get; private set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText1 { get; private set; }
public Baz(
// Base class parameters
string someText,
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet,
// This class parameters
string someText1,
string evenMoreText,
string someText10
) : base(
someText,
testEnum,
someText0,
someInt,
moreText,
someList,
someMap,
someSet)
{
this.someText = someText1;
this.evenMoreText = evenMoreText;
this.someText1 = someText10;
}
public Baz()
{
someText = "";
evenMoreText = "";
someText1 = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
public DerivedEmpty(
// Base class parameters
string someText
) : base(
someText)
{
}
public DerivedEmpty()
{
}
}
} // Test

Просмотреть файл

@ -0,0 +1,210 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt { get; private set; }
[global::Bond.Id(1)]
public int anotherInt { get; private set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString { get; private set; }
public Simple(
int someInt,
int anotherInt,
string someString)
{
this.someInt = someInt;
this.anotherInt = anotherInt;
this.someString = someString;
}
public Simple()
{
someString = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText { get; private set; }
public Foo(
string someText)
{
this.someText = someText;
}
public Foo()
{
someText = "BaseText1";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum { get; private set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; private set; }
[global::Bond.Id(2)]
public int someInt { get; private set; }
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText { get; private set; }
[global::Bond.Id(4)]
public List<Simple> someList { get; private set; }
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public Dictionary<string, double> someMap { get; private set; }
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public HashSet<string> someSet { get; private set; }
public Bar(
// Base class parameters
string someText,
// This class parameters
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
List<Simple> someList,
Dictionary<string, double> someMap,
HashSet<string> someSet
) : base(
someText)
{
this.testEnum = testEnum;
this.someText = someText0;
this.someInt = someInt;
this.moreText = moreText;
this.someList = someList;
this.someMap = someMap;
this.someSet = someSet;
}
public Bar()
{
testEnum = TestEnum.Val2;
someText = "DerivedText1";
moreText = "";
someList = new List<Simple>();
someMap = new Dictionary<string, double>();
someSet = new HashSet<string>();
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText { get; private set; }
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText { get; private set; }
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText1 { get; private set; }
public Baz(
// Base class parameters
string someText,
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
List<Simple> someList,
Dictionary<string, double> someMap,
HashSet<string> someSet,
// This class parameters
string someText1,
string evenMoreText,
string someText10
) : base(
someText,
testEnum,
someText0,
someInt,
moreText,
someList,
someMap,
someSet)
{
this.someText = someText1;
this.evenMoreText = evenMoreText;
this.someText1 = someText10;
}
public Baz()
{
someText = "";
evenMoreText = "";
someText1 = "";
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
public DerivedEmpty(
// Base class parameters
string someText
) : base(
someText)
{
}
public DerivedEmpty()
{
}
}
} // Test

Просмотреть файл

@ -0,0 +1,203 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt;
[global::Bond.Id(1)]
public int anotherInt;
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString = "";
public Simple(
int someInt,
int anotherInt,
string someString)
{
this.someInt = someInt;
this.anotherInt = anotherInt;
this.someString = someString;
}
public Simple()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText = "BaseText1";
public Foo(
string someText)
{
this.someText = someText;
}
public Foo()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum = TestEnum.Val2;
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText = "DerivedText1";
[global::Bond.Id(2)]
public int someInt;
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText = "";
[global::Bond.Id(4), global::Bond.Type(typeof(List<Simple>))]
public IList<Simple> someList = new List<Simple>();
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public IDictionary<string, double> someMap = new Dictionary<string, double>();
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public ISet<string> someSet = new HashSet<string>();
public Bar(
// Base class parameters
string someText,
// This class parameters
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet
) : base(
someText)
{
this.testEnum = testEnum;
this.someText = someText0;
this.someInt = someInt;
this.moreText = moreText;
this.someList = someList;
this.someMap = someMap;
this.someSet = someSet;
}
public Bar()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText = "";
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText = "";
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText1 = "";
public Baz(
// Base class parameters
string someText,
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
IList<Simple> someList,
IDictionary<string, double> someMap,
ISet<string> someSet,
// This class parameters
string someText1,
string evenMoreText,
string someText10
) : base(
someText,
testEnum,
someText0,
someInt,
moreText,
someList,
someMap,
someSet)
{
this.someText = someText1;
this.evenMoreText = evenMoreText;
this.someText1 = someText10;
}
public Baz()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
public DerivedEmpty(
// Base class parameters
string someText
) : base(
someText)
{
}
public DerivedEmpty()
{
}
}
} // Test

Просмотреть файл

@ -0,0 +1,203 @@
// suppress "Missing XML comment for publicly visible type or member"
#pragma warning disable 1591
#region ReSharper warnings
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantNameQualifier
// ReSharper disable InconsistentNaming
// ReSharper disable CheckNamespace
// ReSharper disable UnusedParameter.Local
// ReSharper disable RedundantUsingDirective
#endregion
namespace Test
{
using System.Collections.Generic;
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3,
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Simple
{
[global::Bond.Id(0)]
public int someInt;
[global::Bond.Id(1)]
public int anotherInt;
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someString = "";
public Simple(
int someInt,
int anotherInt,
string someString)
{
this.someInt = someInt;
this.anotherInt = anotherInt;
this.someString = someString;
}
public Simple()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Foo
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText = "BaseText1";
public Foo(
string someText)
{
this.someText = someText;
}
public Foo()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Bar
: Foo
{
[global::Bond.Id(0)]
public TestEnum testEnum = TestEnum.Val2;
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText = "DerivedText1";
[global::Bond.Id(2)]
public int someInt;
[global::Bond.Id(3), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string moreText = "";
[global::Bond.Id(4)]
public List<Simple> someList = new List<Simple>();
[global::Bond.Id(5), global::Bond.Type(typeof(Dictionary<global::Bond.Tag.wstring, double>))]
public Dictionary<string, double> someMap = new Dictionary<string, double>();
[global::Bond.Id(6), global::Bond.Type(typeof(HashSet<global::Bond.Tag.wstring>))]
public HashSet<string> someSet = new HashSet<string>();
public Bar(
// Base class parameters
string someText,
// This class parameters
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
List<Simple> someList,
Dictionary<string, double> someMap,
HashSet<string> someSet
) : base(
someText)
{
this.testEnum = testEnum;
this.someText = someText0;
this.someInt = someInt;
this.moreText = moreText;
this.someList = someList;
this.someMap = someMap;
this.someSet = someSet;
}
public Bar()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class Baz
: Bar
{
[global::Bond.Id(0), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
new public string someText = "";
[global::Bond.Id(1), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string evenMoreText = "";
[global::Bond.Id(2), global::Bond.Type(typeof(global::Bond.Tag.wstring))]
public string someText1 = "";
public Baz(
// Base class parameters
string someText,
TestEnum testEnum,
string someText0,
int someInt,
string moreText,
List<Simple> someList,
Dictionary<string, double> someMap,
HashSet<string> someSet,
// This class parameters
string someText1,
string evenMoreText,
string someText10
) : base(
someText,
testEnum,
someText0,
someInt,
moreText,
someList,
someMap,
someSet)
{
this.someText = someText1;
this.evenMoreText = evenMoreText;
this.someText1 = someText10;
}
public Baz()
{
}
}
[global::Bond.Schema]
[System.CodeDom.Compiler.GeneratedCode("gbc", "0.11.0.0")]
public partial class DerivedEmpty
: Foo
{
public DerivedEmpty(
// Base class parameters
string someText
) : base(
someText)
{
}
public DerivedEmpty()
{
}
}
} // Test

Просмотреть файл

@ -0,0 +1,45 @@
namespace Test
using CustomList<T> = vector<T>;
using BaseText = wstring;
enum TestEnum
{
EnumVal1,
EnumVal2,
EnumVal3
};
struct Simple
{
0: int32 someInt;
1: int32 anotherInt;
2: wstring someString;
};
struct Foo
{
0: BaseText someText = "BaseText1";
}
struct Bar: Foo
{
0: TestEnum testEnum = Val2;
1: wstring someText = "DerivedText1";
2: int32 someInt;
3: wstring moreText;
4: CustomList<Simple> someList;
5: map<wstring, double> someMap;
6: set<wstring> someSet;
};
struct Baz: Bar
{
0: wstring someText;
1: wstring evenMoreText;
2: wstring someText1;
}
struct DerivedEmpty: Foo
{
}

Просмотреть файл

@ -127,6 +127,12 @@ Schema fields are represented by properties with public getter and private
setter and initialized to the default values in the default constructor.
Classes with read-only properties are fully supported by all Bond APIs.
`--preview-constructor-parameters`
A constructor is generated with a parameter to initialize each of the schema
fields. This option is typically used in conjunction with
`--readonly-properties`. This functionailty is in preview and may change.
`--collection-interfaces`
Collection types `vector<T>`, `map<K, V>`, `list<T>` and `set<T>` are