1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace System.Data.Entity
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;
public class DynamicAssembly
{
private readonly Dictionary<string, Tuple<TypeBuilder, ConstructorBuilder>> _typeBuilders =
new Dictionary<string, Tuple<TypeBuilder, ConstructorBuilder>>();
private readonly Dictionary<string, DynamicType> _dynamicTypes = new Dictionary<string, DynamicType>();
private readonly Dictionary<string, Type> _types = new Dictionary<string, Type>();
private readonly List<Attribute> _attributes = new List<Attribute>();
private static int _assemblyCount = 1;
public IEnumerable<DynamicType> DynamicTypes
{
get { return _dynamicTypes.Values; }
}
public IEnumerable<Type> Types
{
get { return _types.Values; }
}
public DynamicStructuralType DynamicStructuralType(string typeName)
{
return GetDynamicType<DynamicStructuralType>(typeName);
}
public DynamicEnumType DynamicEnumType(string typeName)
{
var dynamicEnumType = GetDynamicType<DynamicEnumType>(typeName);
return dynamicEnumType ??
new DynamicEnumType()
{
Name = typeName
};
}
private T GetDynamicType<T>(string typeName)
where T : DynamicType, new()
{
DynamicType dynamicType;
if (!_dynamicTypes.TryGetValue(typeName, out dynamicType))
{
dynamicType =
new T()
{
Name = typeName
};
_dynamicTypes.Add(typeName, dynamicType);
}
return (T)dynamicType;
}
public DynamicAssembly HasAttribute(Attribute a)
{
_attributes.Add(a);
return this;
}
public List<Attribute> Attributes
{
get { return _attributes; }
}
//private static MethodInfo s_RegisterSet = typeof(DbModelBuilder).GetMethod("RegisterSet", BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null);
private static readonly MethodInfo s_Entity = typeof(DbModelBuilder).GetMethod(
"Entity",
BindingFlags.Public |
BindingFlags.Instance, null,
Type.EmptyTypes, null);
public DbModelBuilder ToBuilder()
{
if (Types.Count() == 0)
{
Compile();
}
var builder = new DbModelBuilder();
foreach (var t in Types)
{
var entityMethod = s_Entity.MakeGenericMethod(t);
entityMethod.Invoke(builder, null);
}
return builder;
}
public Assembly Compile()
{
return Compile(new AssemblyName(string.Format("DynamicEntities{0}", _assemblyCount)));
}
public Assembly Compile(AssemblyName assemblyName)
{
var assemblyBuilder =
AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
foreach (var attribute in Attributes)
{
assemblyBuilder.SetCustomAttribute(AnnotationAttributeBuilder.Create(attribute));
}
var moduleName = string.Format("DynamicEntitiesModule{0}.dll", _assemblyCount);
var module = assemblyBuilder.DefineDynamicModule(moduleName);
_assemblyCount++;
foreach (var enumTypeInfo in DynamicTypes.OfType<DynamicEnumType>())
{
_types.Add(enumTypeInfo.Name, DefineEnumType(module, enumTypeInfo));
}
foreach (var typeInfo in DynamicTypes.OfType<DynamicStructuralType>())
{
DefineStructuralType(module, typeInfo);
}
foreach (var typeInfo in DynamicTypes.OfType<DynamicStructuralType>())
{
var typeBuilder = _typeBuilders[typeInfo.Name];
foreach (var fieldInfo in typeInfo.Fields)
{
DefineField(typeBuilder.Item1, typeBuilder.Item2, fieldInfo);
}
foreach (var propertyInfo in typeInfo.Properties)
{
DefineProperty(typeBuilder.Item1, propertyInfo);
}
}
foreach (var t in _typeBuilders)
{
_types.Add(t.Key, t.Value.Item1.CreateType());
}
return assemblyBuilder;
}
public Type GetType(string typeName)
{
return _types[typeName];
}
public bool TryGetType(string typeName, out Type type)
{
return _types.TryGetValue(typeName, out type);
}
private void DefineStructuralType(ModuleBuilder module, DynamicStructuralType typeInfo)
{
var typeAttributes = TypeAttributes.Class | GetTypeAccess(typeInfo.TypeAccess);
if (typeInfo.IsAbstract)
{
typeAttributes |= TypeAttributes.Abstract;
}
if (typeInfo.IsSealed)
{
typeAttributes |= TypeAttributes.Sealed;
}
Type baseClass = null;
if (typeInfo.BaseClass is Type)
{
baseClass = typeInfo.BaseClass as Type;
}
else if (typeInfo.BaseClass is DynamicStructuralType)
{
baseClass = _typeBuilders[((DynamicStructuralType)typeInfo.BaseClass).Name].Item1;
}
var typeBuilder = module.DefineType(typeInfo.Name, typeAttributes, baseClass);
foreach (var a in typeInfo.Attributes)
{
typeBuilder.SetCustomAttribute(AnnotationAttributeBuilder.Create(a));
}
// Define the Ctor
var constructorBuilder = typeInfo.CtorAccess == MemberAccess.None
? null
: typeBuilder.DefineDefaultConstructor(GetMethodAttributes(false, typeInfo.CtorAccess));
_typeBuilders.Add(typeInfo.Name, Tuple.Create(typeBuilder, constructorBuilder));
}
private void DefineField(TypeBuilder typeBuilder, ConstructorBuilder constructorBuilder, DynamicField fieldInfo)
{
var fieldAttributes = FieldAttributes.Public;
if (fieldInfo.Static)
{
fieldAttributes |= FieldAttributes.Static;
}
var fieldType = _typeBuilders[fieldInfo.FieldType.Name].Item1;
var fieldBuilder = typeBuilder.DefineField(fieldInfo.FieldName, fieldType, fieldAttributes);
if (fieldInfo.SetInstancePattern)
{
var staticConstructorBuilder = typeBuilder.DefineConstructor(
MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, Type.EmptyTypes);
var generator = staticConstructorBuilder.GetILGenerator();
generator.Emit(OpCodes.Newobj, constructorBuilder);
generator.Emit(OpCodes.Stsfld, fieldBuilder);
generator.Emit(OpCodes.Ret);
}
}
private void DefineProperty(TypeBuilder typeBuilder, DynamicProperty propertyInfo)
{
var getterAccess = propertyInfo.GetterAccess;
var setterAccess = propertyInfo.SetterAccess;
Type propertyType;
if (propertyInfo.EnumType != null)
{
propertyType = _types[propertyInfo.EnumType.Item1.Name];
if (propertyInfo.EnumType.Item2)
{
propertyType = typeof(Nullable<>).MakeGenericType(propertyType);
}
}
else if (propertyInfo.CollectionType != null)
{
if (propertyInfo.ReferenceType != null)
{
propertyType =
propertyInfo.CollectionType.MakeGenericType(_typeBuilders[propertyInfo.ReferenceType.Name].Item1);
}
else
{
propertyType = propertyInfo.CollectionType.MakeGenericType(propertyInfo.PropertyType);
}
}
else if (propertyInfo.ReferenceType != null)
{
propertyType = _typeBuilders[propertyInfo.ReferenceType.Name].Item1;
switch (_dynamicTypes[propertyInfo.ReferenceType.Name].TypeAccess)
{
case MemberAccess.Private:
getterAccess = MemberAccess.Private;
setterAccess = MemberAccess.Private;
break;
case MemberAccess.Internal:
getterAccess = MemberAccess.Internal;
setterAccess = MemberAccess.Internal;
break;
}
if (propertyInfo.PropertyType != null
&& propertyInfo.PropertyType.IsGenericTypeDefinition)
{
propertyType = propertyInfo.PropertyType.MakeGenericType(propertyType);
}
}
else
{
propertyType = propertyInfo.PropertyType;
}
var fieldBuilder = typeBuilder.DefineField(
"_" + propertyInfo.PropertyName, propertyType,
FieldAttributes.Private);
var propertyBuilder = typeBuilder.DefineProperty(
propertyInfo.PropertyName,
PropertyAttributes.None,
propertyType, Type.EmptyTypes);
foreach (var a in propertyInfo.Attributes)
{
propertyBuilder.SetCustomAttribute(AnnotationAttributeBuilder.Create(a));
}
if (propertyInfo.GetterAccess
!= MemberAccess.None)
{
var getter = typeBuilder.DefineMethod(
"get_" + propertyInfo.PropertyName,
GetMethodAttributes(propertyInfo.IsVirtual, getterAccess),
propertyType,
Type.EmptyTypes);
var generator = getter.GetILGenerator();
generator.Emit(OpCodes.Ldarg_0);
generator.Emit(OpCodes.Ldfld, fieldBuilder);
generator.Emit(OpCodes.Ret);
propertyBuilder.SetGetMethod(getter);
}
if (propertyInfo.SetterAccess
!= MemberAccess.None)
{
var setter = typeBuilder.DefineMethod(
"set_" + propertyInfo.PropertyName,
GetMethodAttributes(propertyInfo.IsVirtual, setterAccess),
null,
new[] { propertyType });
var generator = setter.GetILGenerator();
generator.Emit(OpCodes.Ldarg_0);
generator.Emit(OpCodes.Ldarg_1);
generator.Emit(OpCodes.Stfld, fieldBuilder);
generator.Emit(OpCodes.Ret);
propertyBuilder.SetSetMethod(setter);
}
}
private Type DefineEnumType(ModuleBuilder module, DynamicEnumType enumTypeInfo)
{
var enumBuilder =
module.DefineEnum(
enumTypeInfo.Name,
GetTypeAccess(enumTypeInfo.TypeAccess),
enumTypeInfo.UnderlyingType);
foreach (var a in enumTypeInfo.Attributes)
{
enumBuilder.SetCustomAttribute(AnnotationAttributeBuilder.Create(a));
}
foreach (var enumMember in enumTypeInfo.Members)
{
enumBuilder.DefineLiteral(
enumMember.Key,
Convert.ChangeType(enumMember.Value, enumTypeInfo.UnderlyingType));
}
return enumBuilder.CreateType();
}
private static TypeAttributes GetTypeAccess(MemberAccess typeAccess)
{
TypeAttributes typeAttributes = 0;
switch (typeAccess)
{
case MemberAccess.Public:
typeAttributes |= TypeAttributes.Public;
break;
case MemberAccess.Private:
case MemberAccess.Internal:
typeAttributes |= TypeAttributes.NotPublic;
break;
}
return typeAttributes;
}
private static MethodAttributes GetMethodAttributes(bool isVirtual, MemberAccess memberAccess)
{
var attributes = MethodAttributes.HideBySig | MethodAttributes.SpecialName;
if (isVirtual)
{
attributes |= MethodAttributes.Virtual;
}
switch (memberAccess)
{
case MemberAccess.Public:
attributes |= MethodAttributes.Public | MethodAttributes.NewSlot;
break;
case MemberAccess.Private:
attributes |= MethodAttributes.Private;
break;
case MemberAccess.Internal:
attributes |= MethodAttributes.Assembly | MethodAttributes.NewSlot;
break;
case MemberAccess.Protected:
attributes |= MethodAttributes.Family | MethodAttributes.NewSlot;
break;
case MemberAccess.ProtectedInternal:
attributes |= MethodAttributes.FamORAssem | MethodAttributes.NewSlot;
break;
}
return attributes;
}
}
public class AnnotationAttributeBuilder
{
public static CustomAttributeBuilder Create(dynamic attribute)
{
CustomAttributeBuilder builder = CreateCustom(attribute);
if (builder == null)
{
object[] args = GetArgs(attribute);
return
new CustomAttributeBuilder(
attribute.GetType().GetConstructor(args.Select(x => x.GetType()).ToArray()), args);
}
return builder;
}
public static CustomAttributeBuilder CreateCustom(dynamic attribute)
{
return null;
}
public static CustomAttributeBuilder CreateCustom(DataMemberAttribute attribute)
{
if (attribute.Order
== -1)
{
return new CustomAttributeBuilder(
typeof(DataMemberAttribute).GetConstructor(Type.EmptyTypes),
new object[] { },
new PropertyInfo[] { },
new object[] { });
}
else
{
return new CustomAttributeBuilder(
typeof(DataMemberAttribute).GetConstructor(Type.EmptyTypes),
new object[] { },
new[] { typeof(DataMemberAttribute).GetProperty("Order") },
new object[] { attribute.Order });
}
}
public static CustomAttributeBuilder CreateCustom(EdmTypeAttribute attribute)
{
return new CustomAttributeBuilder(
attribute.GetType().GetConstructor(Type.EmptyTypes),
new object[0],
new PropertyInfo[]
{
typeof(EdmTypeAttribute).GetProperty("Name"),
typeof(EdmTypeAttribute).GetProperty("NamespaceName")
},
new object[]
{
attribute.Name,
attribute.NamespaceName
});
}
public static CustomAttributeBuilder CreateCustom(EdmScalarPropertyAttribute attribute)
{
return new CustomAttributeBuilder(
attribute.GetType().GetConstructor(Type.EmptyTypes),
new object[0],
new PropertyInfo[]
{
typeof(EdmScalarPropertyAttribute).GetProperty("EntityKeyProperty"),
typeof(EdmScalarPropertyAttribute).GetProperty("IsNullable")
},
new object[]
{
attribute.EntityKeyProperty,
attribute.IsNullable
});
}
private static object[] GetArgs(dynamic attribute)
{
return GetArgs(attribute);
}
private static object[] GetArgs(KeyAttribute attribute)
{
return new object[] { };
}
private static object[] GetArgs(RequiredAttribute attribute)
{
return new object[] { };
}
private static object[] GetArgs(TimestampAttribute attribute)
{
return new object[] { };
}
private static object[] GetArgs(ConcurrencyCheckAttribute attribute)
{
return new object[] { };
}
private static object[] GetArgs(StringLengthAttribute attribute)
{
return new object[] { attribute.MaximumLength };
}
private static object[] GetArgs(MaxLengthAttribute attribute)
{
return new object[] { attribute.Length };
}
private static object[] GetArgs(DatabaseGeneratedAttribute attribute)
{
return new object[] { attribute.DatabaseGeneratedOption };
}
private static object[] GetArgs(EdmEntityTypeAttribute attribute)
{
return new object[] { };
}
private static object[] GetArgs(EdmSchemaAttribute attribute)
{
return new object[] { };
}
private static object[] GetArgs(EdmRelationshipNavigationPropertyAttribute attribute)
{
return new object[]
{
attribute.RelationshipNamespaceName,
attribute.RelationshipName,
attribute.TargetRoleName
};
}
private static object[] GetArgs(EdmComplexPropertyAttribute attribute)
{
return new object[0];
}
}
public enum MemberAccess
{
None,
Public,
Private,
Internal,
Protected,
ProtectedInternal
}
public class DynamicProperty
{
private MemberAccess _getterAccess = MemberAccess.Public;
private MemberAccess _setterAccess = MemberAccess.Public;
private bool _isVirtual = true;
private readonly List<Attribute> _attributes = new List<Attribute>();
public Type PropertyType { get; set; }
public DynamicProperty HasType(Type propertyType)
{
PropertyType = propertyType;
return this;
}
public DynamicProperty HasType<T>()
{
PropertyType = typeof(T);
return this;
}
public Tuple<DynamicEnumType, bool> EnumType { get; set; }
public Tuple<DynamicEnumType, bool> HasEnumType(DynamicEnumType enumType, bool nullable)
{
EnumType = new Tuple<DynamicEnumType,bool>(enumType, nullable);
return EnumType;
}
public DynamicStructuralType ReferenceType { get; set; }
public DynamicProperty HasReferenceType(DynamicStructuralType referenceType)
{
ReferenceType = referenceType;
return this;
}
public Type CollectionType { get; set; }
public DynamicProperty HasCollectionType(Type collectionType, DynamicStructuralType referenceType)
{
CollectionType = collectionType;
ReferenceType = referenceType;
return this;
}
public List<Attribute> Attributes
{
get { return _attributes; }
}
public DynamicProperty HasAttribute(Attribute a)
{
_attributes.Add(a);
return this;
}
public string PropertyName { get; set; }
public DynamicProperty HasName(string propertyName)
{
PropertyName = propertyName;
return this;
}
public MemberAccess GetterAccess
{
get { return _getterAccess; }
set { _getterAccess = value; }
}
public DynamicProperty HasGetterAccess(MemberAccess access)
{
GetterAccess = access;
return this;
}
public MemberAccess SetterAccess
{
get { return _setterAccess; }
set { _setterAccess = value; }
}
public DynamicProperty HasSetterAccess(MemberAccess access)
{
SetterAccess = access;
return this;
}
public bool IsVirtual
{
get { return _isVirtual; }
set { _isVirtual = value; }
}
public DynamicProperty HasVirtual(bool isVirtual)
{
IsVirtual = isVirtual;
return this;
}
}
public class DynamicField
{
public DynamicStructuralType FieldType { get; set; }
public string FieldName { get; set; }
public bool Static { get; set; }
public bool SetInstancePattern { get; set; }
public DynamicField HasType(DynamicStructuralType propertyType)
{
FieldType = propertyType;
return this;
}
public DynamicField HasName(string propertyName)
{
FieldName = propertyName;
return this;
}
public DynamicField IsStatic()
{
Static = true;
return this;
}
/// <summary>
/// Sets the field up to match the Instance singleton pattern required by ADO.NET.
/// </summary>
public DynamicField IsInstance()
{
SetInstancePattern = true;
return this;
}
}
public abstract class DynamicType
{
private readonly List<Attribute> _attributes = new List<Attribute>();
public string Name { get; set; }
public List<Attribute> Attributes
{
get { return _attributes; }
}
private MemberAccess _typeAccess = MemberAccess.Public;
public MemberAccess TypeAccess
{
get { return _typeAccess; }
set { _typeAccess = value; }
}
}
public class DynamicStructuralType : DynamicType
{
private readonly Dictionary<string, DynamicProperty> _properties = new Dictionary<string, DynamicProperty>();
private readonly Dictionary<string, DynamicField> _fields = new Dictionary<string, DynamicField>();
private MemberAccess _ctorAccess = MemberAccess.None;
public DynamicStructuralType HasName(string name)
{
Name = name;
return this;
}
public bool IsSealed { get; set; }
public DynamicStructuralType HasSealed(bool isSealed)
{
IsSealed = isSealed;
return this;
}
public bool IsAbstract { get; set; }
public DynamicStructuralType HasAbstract(bool isAbstract)
{
IsAbstract = isAbstract;
return this;
}
public DynamicStructuralType HasAttribute(Attribute a)
{
Attributes.Add(a);
return this;
}
public DynamicStructuralType HasClassAccess(MemberAccess access)
{
TypeAccess = access;
return this;
}
public MemberAccess CtorAccess
{
get { return _ctorAccess; }
set { _ctorAccess = value; }
}
public DynamicProperty Property(string propertyName)
{
DynamicProperty property;
if (!_properties.TryGetValue(propertyName, out property))
{
property = new DynamicProperty();
property.PropertyName = propertyName;
_properties.Add(propertyName, property);
}
return property;
}
public DynamicField Field(string fieldName)
{
DynamicField field;
if (!_fields.TryGetValue(fieldName, out field))
{
field = new DynamicField
{
FieldName = fieldName
};
_fields.Add(fieldName, field);
}
return field;
}
public object BaseClass { get; set; }
public DynamicStructuralType HasBaseClass(object baseClass)
{
BaseClass = baseClass;
return this;
}
public IEnumerable<DynamicProperty> Properties
{
get { return _properties.Values; }
}
public IEnumerable<DynamicField> Fields
{
get { return _fields.Values; }
}
}
public class DynamicEnumType : DynamicType
{
private readonly Dictionary<string, object> _members = new Dictionary<string, object>();
public DynamicEnumType HasName(string name)
{
Name = name;
return this;
}
public DynamicEnumType()
{
UnderlyingType = typeof(int);
}
public DynamicEnumType HasClassAccess(MemberAccess access)
{
TypeAccess = access;
return this;
}
public Type UnderlyingType { get; set; }
public DynamicEnumType HasUnderlyingType(Type type)
{
UnderlyingType = type;
return this;
}
public DynamicEnumType HasAttribute(Attribute a)
{
Attributes.Add(a);
return this;
}
public IEnumerable<KeyValuePair<string, object>> Members
{
get { return _members; }
}
public DynamicEnumType HasMember(string name, object value)
{
_members[name] = value;
return this;
}
}
}
|