internal static IEnumerable<string> GetNamespacesToImport(EntityModelSchema model) { yield return "System"; yield return "System.Collections.Generic"; yield return "System.Collections.ObjectModel"; yield return "Microsoft.OData.Client"; yield return "System.Linq"; yield return typeof(AsyncHelpers).Namespace; yield return typeof(ClientQueryExtensionMethods).Namespace; if (model.HasSpatialFeatures()) { // needed for extension methods for distance, etc. yield return "Microsoft.Spatial"; } }
internal static IEnumerable<string> GetAssembliesToReference(EntityModelSchema model, IProgrammingLanguageStrategy language) { if (language.LanguageName != "VB") { yield return "mscorlib.dll"; } yield return "System.dll"; yield return "System.Core.dll"; #if SILVERLIGHT && !WIN8 yield return DataFxAssemblyRef.File.DataServicesSilverlightClient; #else yield return DataFxAssemblyRef.File.DataServicesClient; #endif yield return DataFxAssemblyRef.File.ODataLib; yield return DataFxAssemblyRef.File.EntityDataModel; if (model.HasSpatialFeatures()) { yield return DataFxAssemblyRef.File.SpatialCore; } #if SILVERLIGHT && !WIN8 yield return "System.Windows.dll"; yield return "Microsoft.Test.Taupo.SL.dll"; yield return "Microsoft.Test.Taupo.Astoria.SL.dll"; yield return "Microsoft.Test.Taupo.Query.SL.dll"; #else yield return "Microsoft.Test.Taupo.dll"; yield return "Microsoft.Test.Taupo.Astoria.dll"; yield return "Microsoft.Test.Taupo.Query.dll"; #endif }
/// <summary> /// Gets the reference assemblies needed to compile a client for the given model and language /// </summary> /// <param name="model">The model being generated</param> /// <param name="language">The current language</param> /// <returns>The list of reference assemblies</returns> internal static IEnumerable<string> GetClientReferenceAssemblies(EntityModelSchema model, IProgrammingLanguageStrategy language) { bool isVB = language.LanguageName == "VB"; IEnumerable<string> languageSpecificReferences = isVB ? referenceAssemblies.Where(l => l != "mscorlib.dll") : referenceAssemblies; if (model.HasSpatialFeatures()) { languageSpecificReferences = languageSpecificReferences.Concat(DataFxAssemblyRef.File.SpatialCore); } return languageSpecificReferences; }