CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ObjectFactoryLoaderT.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="ObjectFactoryLoader.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>no summary</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections.Generic;
10using System.Linq;
11using System.Text;
12
14{
15 public class ObjectFactoryLoader<T> : Csla.Server.IObjectFactoryLoader where T: class
16 {
17 private readonly ApplicationContext _applicationContext;
18 public ObjectFactoryLoader(ApplicationContext applicationContext)
19 {
20 _applicationContext = applicationContext;
21 }
22
23 public Type GetFactoryType(string factoryName)
24 {
25 if (factoryName == "Csla.Test.ObjectFactory.RootFactory, Csla.Tests")
26 {
27 return typeof(T);
28 }
29 else
30 return null;
31 }
32
33 public object GetFactory(string factoryName)
34 {
35 if (factoryName == "Csla.Test.ObjectFactory.RootFactory, Csla.Tests")
36 {
37 return _applicationContext.CreateInstanceDI<T>();
38 }
39 else
40 return null;
41 }
42 }
43}
Provides consistent context information between the client and server DataPortal objects.
ObjectFactoryLoader(ApplicationContext applicationContext)
Type GetFactoryType(string factoryName)
Returns the type of the factory object.
object GetFactory(string factoryName)
Returns an ObjectFactory object.