@@ -24,6 +24,7 @@ public DocumentDBBinding(ScriptHostConfiguration config, DocumentDBBindingMetada
2424 DatabaseName = metadata . DatabaseName ;
2525 CollectionName = metadata . CollectionName ;
2626 CreateIfNotExists = metadata . CreateIfNotExists ;
27+ ConnectionString = metadata . Connection ;
2728 _bindingDirection = metadata . Direction ;
2829 }
2930
@@ -33,6 +34,8 @@ public DocumentDBBinding(ScriptHostConfiguration config, DocumentDBBindingMetada
3334
3435 public bool CreateIfNotExists { get ; private set ; }
3536
37+ public string ConnectionString { get ; private set ; }
38+
3639 public override bool HasBindingParameters
3740 {
3841 get
@@ -44,24 +47,29 @@ public override bool HasBindingParameters
4447 public override Collection < CustomAttributeBuilder > GetCustomAttributes ( )
4548 {
4649 Type attributeType = typeof ( DocumentDBAttribute ) ;
50+
51+ object [ ] constructorValues = new object [ ]
52+ {
53+ DatabaseName ,
54+ CollectionName
55+ } ;
56+
4757 PropertyInfo [ ] props = new [ ]
4858 {
49- attributeType . GetProperty ( "DatabaseName" ) ,
50- attributeType . GetProperty ( "CollectionName" ) ,
51- attributeType . GetProperty ( "CreateIfNotExists" )
59+ attributeType . GetProperty ( "CreateIfNotExists" ) ,
60+ attributeType . GetProperty ( "ConnectionString" )
5261 } ;
5362
5463 object [ ] propValues = new object [ ]
5564 {
56- DatabaseName ,
57- CollectionName ,
58- CreateIfNotExists
65+ CreateIfNotExists ,
66+ ConnectionString
5967 } ;
6068
61- ConstructorInfo constructor = attributeType . GetConstructor ( System . Type . EmptyTypes ) ;
69+ ConstructorInfo constructor = attributeType . GetConstructor ( new [ ] { typeof ( string ) , typeof ( string ) } ) ;
6270 return new Collection < CustomAttributeBuilder > ( )
6371 {
64- new CustomAttributeBuilder ( constructor , new object [ ] { } , props , propValues )
72+ new CustomAttributeBuilder ( constructor , constructorValues , props , propValues )
6573 } ;
6674 }
6775
@@ -70,11 +78,10 @@ public override async Task BindAsync(BindingContext context)
7078 // Only output bindings are supported.
7179 if ( Access == FileAccess . Write && _bindingDirection == BindingDirection . Out )
7280 {
73- DocumentDBAttribute attribute = new DocumentDBAttribute
81+ DocumentDBAttribute attribute = new DocumentDBAttribute ( DatabaseName , CollectionName )
7482 {
75- DatabaseName = DatabaseName ,
76- CollectionName = CollectionName ,
77- CreateIfNotExists = CreateIfNotExists
83+ CreateIfNotExists = CreateIfNotExists ,
84+ ConnectionString = ConnectionString
7885 } ;
7986
8087 RuntimeBindingContext runtimeContext = new RuntimeBindingContext ( attribute ) ;
0 commit comments