66
77using System ;
88using System . Collections . Generic ;
9+ using System . Linq ;
10+ using System . Runtime . Loader ;
911using Xtensive . Core ;
1012using Xtensive . Orm . Building . Builders ;
1113using Xtensive . Orm . Linq . MemberCompilation ;
@@ -123,7 +125,7 @@ protected virtual IPostCompiler CreatePostCompiler(CompilerConfiguration configu
123125 /// <returns>Compiler containers for current provider.</returns>
124126 protected virtual IEnumerable < Type > GetProviderCompilerContainers ( )
125127 {
126- return new [ ] {
128+ IEnumerable < Type > basicCompilerContainers = new [ ] {
127129 typeof ( NullableCompilers ) ,
128130 typeof ( StringCompilers ) ,
129131 typeof ( DateTimeCompilers ) ,
@@ -135,10 +137,29 @@ protected virtual IEnumerable<Type> GetProviderCompilerContainers()
135137 typeof ( NumericCompilers ) ,
136138 typeof ( DecimalCompilers ) ,
137139 typeof ( GuidCompilers ) ,
138- //typeof (VbStringsCompilers),
139- //typeof (VbDateAndTimeCompilers),
140140 typeof ( EnumCompilers ) ,
141141 } ;
142+ var result = basicCompilerContainers ;
143+ var allLoadedAssemblies = AssemblyLoadContext . All . SelectMany ( static c => c . Assemblies ) ;
144+ // dynamic registration to not cause assembly loading
145+ if ( allLoadedAssemblies . Any ( static a => a . GetName ( ) . Name . Equals ( "FSharp.Core" , StringComparison . OrdinalIgnoreCase ) ) ) {
146+ result = result . Concat ( new [ ] {
147+ typeof ( FSharpMathOperationsCompilers ) ,
148+ typeof ( FSharpOperatorsCompilers ) ,
149+ typeof ( FSharpStringCompilers ) ,
150+ typeof ( FSharpConversionsCompilers ) ,
151+ } ) ;
152+ }
153+
154+ if ( allLoadedAssemblies . Any ( static a => a . GetName ( ) . Name . StartsWith ( "Microsoft.VisualBasic" , StringComparison . OrdinalIgnoreCase ) ) ) {
155+ result = result . Concat ( new [ ] {
156+ typeof ( VbConversionsCompilers ) ,
157+ typeof ( VbStringsCompilers ) ,
158+ typeof ( VbDateAndTimeCompilers ) ,
159+ } ) ;
160+ }
161+
162+ return result ;
142163 }
143164
144165 protected virtual SearchConditionCompiler CreateSearchConditionVisitor ( )
0 commit comments