Prism on .net 3.0

Aug 21, 2008 at 8:42 PM

Hi,

  I would like to ask if someone tries to use Prism on .net 3.0. Is it possible or too many changes must be made? For now I'm using SCSF with WPF support but it's too slow and too "complex" for my need. However I have some limitations so I'm not able to use .net 3.5 for my current project.

  Thank you for your answers

Jarda

Aug 22, 2008 at 1:31 AM
Hi jardajirava, since LINQ was introduced with .NET 3.5 you won't be able to compile any LINQ code.  I went ahead and did a solution scan for the FirstOrDefault LINQ operator, since this is only one operator there may be more affected classes but this will give you an idea what you would be in for.  You may want to review these files to if it is a battle you want to take on; the Region.cs is a major player so it might be a place to start. 

Find all "=>", Subfolders, Find Results 1, "Entire Solution"
  D:\GWN\Source\CAL\Composite\Events\BackgroundEventSubscription.cs(50):            worker.DoWork += ((sender, e) => action((TPayload)e.Argument));
  D:\GWN\Source\CAL\Composite\Events\EventAggregator.cs(39):            TEventType eventInstance = _events.FirstOrDefault(evt => evt.GetType() == typeof(TEventType)) as TEventType;
  D:\GWN\Source\CAL\Composite\Events\EventBase.cs(82):                IEventSubscription subscription = Subscriptions.FirstOrDefault(evt => evt.SubscriptionToken == token);
  D:\GWN\Source\CAL\Composite\Events\EventBase.cs(99):                IEventSubscription subscription = Subscriptions.FirstOrDefault(evt => evt.SubscriptionToken == token);
  D:\GWN\Source\CAL\Composite\Events\EventSubscription.cs(101):                return arguments =>
  D:\GWN\Source\CAL\Composite\Modularity\ConfigurationModuleEnumerator.cs(102):            return _modules.Where(moduleInfo => moduleInfo.StartupLoaded == true).ToArray();
  D:\GWN\Source\CAL\Composite\Modularity\ConfigurationModuleEnumerator.cs(113):            return _modules.FirstOrDefault(moduleInfo => moduleInfo.ModuleName == moduleName);
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(72):            return _modules.Where(moduleInfo => moduleInfo.StartupLoaded == true).ToArray();
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(83):            return _modules.FirstOrDefault(moduleInfo => moduleInfo.ModuleName == moduleName);
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(155):                                asm => string.Equals(asm.FullName, args.Name, StringComparison.InvariantCultureIgnoreCase));
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(173):                        asm => asm.FullName == typeof(IModule).Assembly.FullName);
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(178):    .Where(file => alreadyLoadedAssemblies
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(179):        .FirstOrDefault(assembly => String.Compare(Path.GetFileName(assembly.Location), file.Name, StringComparison.OrdinalIgnoreCase) == 0) == null)
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(180):    .SelectMany(file => Assembly.ReflectionOnlyLoadFrom(file.FullName)
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(183):                            .Where(t => t != IModuleType)
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(184):                            .Select(type => CreateModuleInfo(type)));
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(205):                var moduleAttribute = CustomAttributeData.GetCustomAttributes(type).FirstOrDefault(cad => cad.Constructor.DeclaringType.FullName == typeof(ModuleAttribute).FullName);
  D:\GWN\Source\CAL\Composite\Modularity\DirectoryLookupModuleEnumerator.cs(219):                var moduleDependencyAttributes = CustomAttributeData.GetCustomAttributes(type).Where(cad => cad.Constructor.DeclaringType.FullName == typeof(ModuleDependencyAttribute).FullName);
  D:\GWN\Source\CAL\Composite\Modularity\StaticModuleEnumerator.cs(56):            return _modules.FirstOrDefault(moduleInfo => moduleInfo.ModuleName == moduleName);
  D:\GWN\Source\CAL\Composite.Wpf\Events\CompositeWpfEvent.cs(160):                IEventSubscription eventSubscription = Subscriptions.Cast<EventSubscription<TPayload>>().FirstOrDefault(evt => evt.Action == subscriber);
  D:\GWN\Source\CAL\Composite.Wpf\Events\CompositeWpfEvent.cs(178):                eventSubscription = Subscriptions.Cast<EventSubscription<TPayload>>().FirstOrDefault(evt => evt.Action == subscriber);
  D:\GWN\Source\CAL\Composite.Wpf\Regions\Region.cs(47):                    _views = new ViewsCollection(ItemMetadataCollection, x => true);
  D:\GWN\Source\CAL\Composite.Wpf\Regions\Region.cs(63):                    _activeViews = new ViewsCollection(ItemMetadataCollection, x => x.IsActive);
  D:\GWN\Source\CAL\Composite.Wpf\Regions\Region.cs(171):            ItemMetadata metadata = ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName);
  D:\GWN\Source\CAL\Composite.Wpf\Regions\Region.cs(205):            if (ItemMetadataCollection.FirstOrDefault(x => x.Item == view) != null)
  D:\GWN\Source\CAL\Composite.Wpf\Regions\Region.cs(211):                if (ItemMetadataCollection.FirstOrDefault(x => x.Name == name) != null)
  D:\GWN\Source\CAL\Composite.Wpf\Regions\Region.cs(231):            ItemMetadata itemMetadata = ItemMetadataCollection.FirstOrDefault(x => x.Item == view);
  D:\GWN\Source\QuickStarts\EventAggregation\ModuleB\ActivityPresenter.cs(61):                                                             fundOrder => fundOrder.CustomerId == _customerId);


UNIT TEST AFFECTED FOLLOW:

  D:\GWN\Source\CAL\Composite.Wpf.Tests\Commands\CompositeCommandFixture.cs(386):            CanExecuteChanged += ((sender, e) => CanExecuteChangedRaised = true);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Events\DispatcherEventSubscriptionFixture.cs(42):                Target = (Action<object>)(arg =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Events\DispatcherEventSubscriptionFixture.cs(51):                Target = (Predicate<object>)(arg => true)
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Events\DispatcherEventSubscriptionFixture.cs(94):                    (Action<object>)(arg1 =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\RegionFixture.cs(307):            region.Views.CollectionChanged += (sender, e) =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\RegionFixture.cs(326):            region.Views.CollectionChanged += (sender, e) =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\RegionFixture.cs(345):            region.Views.CollectionChanged += (sender, e) =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\RegionFixture.cs(365):            region.Views.CollectionChanged += (sender, e) =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\RegionFixture.cs(386):            region.ActiveViews.CollectionChanged += (o, e) =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(35):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => true);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(49):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => x.Name == "Posible");
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(66):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => x.IsActive);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(68):            viewsCollection.CollectionChanged += (s, e) => collectionChanged = true;
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(79):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => x.IsActive);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(82):            viewsCollection.CollectionChanged += (s, e) =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(109):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => x.IsActive);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(111):            viewsCollection.CollectionChanged += (s, e) => collectionChanged = true;
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(124):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => true);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(126):            viewsCollection.CollectionChanged += (s, e) =>
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(147):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => true);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(158):            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => x.IsActive);
  D:\GWN\Source\CAL\Composite.Wpf.Tests\Regions\ViewsCollectionFixture.cs(161):            viewsCollection.CollectionChanged += (s, e) =>
  D:\GWN\Source\CAL\Composite.UnityExtensions.Tests\UnityBootstrapperFixture.cs(320):            Assert.IsNotNull(messages.FirstOrDefault(msg => msg.Contains("Creating Unity container")));
  D:\GWN\Source\CAL\Composite.UnityExtensions.Tests\UnityBootstrapperFixture.cs(321):            Assert.IsNotNull(messages.FirstOrDefault(msg => msg.Contains("Configuring container")));
  D:\GWN\Source\CAL\Composite.UnityExtensions.Tests\UnityBootstrapperFixture.cs(322):            Assert.IsNotNull(messages.FirstOrDefault(msg => msg.Contains("Configuring region adapters")));
  D:\GWN\Source\CAL\Composite.UnityExtensions.Tests\UnityBootstrapperFixture.cs(323):            Assert.IsNotNull(messages.FirstOrDefault(msg => msg.Contains("Creating shell")));
  D:\GWN\Source\CAL\Composite.UnityExtensions.Tests\UnityBootstrapperFixture.cs(324):            Assert.IsNotNull(messages.FirstOrDefault(msg => msg.Contains("Initializing modules")));
  D:\GWN\Source\CAL\Composite.UnityExtensions.Tests\UnityBootstrapperFixture.cs(325):            Assert.IsNotNull(messages.FirstOrDefault(msg => msg.Contains("Bootstrapper sequence completed")));
  D:\GWN\Source\CAL\Composite.UnityExtensions.Tests\UnityBootstrapperFixture.cs(350):            Assert.IsNotNull(messages.FirstOrDefault(msg => msg.Contains("Type 'IRegionManager' was already registered by the application")));
  Matching lines: 57    Matching files: 15    Total files searched: 765
Aug 22, 2008 at 2:49 PM
Hi Bill,

  thank you for your reply. If I know that there are only the extension methods with simple lambda expressions and nothing special I try to use LinqBridge.

  It is then quite easy without any modification - only the target must be changed to 3.0 - and nothing more. So if anyone need to use Prism with .net 3.0 it is possible :-)

  Thank you and have a nice day

Jarda