SERVER SIDE CREATION
DAL CREATION
I. Logically organize your data…
a. Only include the tables that will be directly required by the Maintenance Screen, Utility Screen, Or Process, ect…
b. I will Use the User Maintenance UI as my step through…
i. We will always include the following tables…
1. Company table -- will parent 99% of all XERP tables allowing for multiple companies…
2. Temp –
a. Physical table in SQL that should never be populated with data…
b. The physical table is used logically in XERP as a generic schema defined object allowing for a strongly typed object to be used in a generic way…
c. Allowing us to transmit generic data through WCF Data Services as WCF Data Service requires Strongly Typed Objects.
d. It is used but not limited to by XERP to transmit the Schema definitions of each table included in the DAL to allow the client to be known as to how
e. to set the Max Field Length for each string field included in each of tables included in the Entity…
3. UDLists and UDListItems – These tables will allow you to publish customized lists to the module…
a. You may need an extra list for this or that…
b. This will allow you to capture user defined lists to one table throughout XERP…
c. Allowing you to share the lists among multiple modules in XERP…
d. Mostly used to populate Drop downs…
II. Create a database Diagram in SQL Server
a. This will allow you a sand box to identify all the tables that you will include in the Entity within the DAL Project…
b. It has no bearing on the Module other than helping you to organize the table requirements…
c. Open up SQL Server…
i. Locate the XERP DataBaseDataBase Diagrams
ii. Right click on the Data Diagrams and select New Database Diagram…
A-1.png
Diagram A-1 SQL Server DataBase Diagrams…
iii. Below are the tables that I added to UserMaintenance DataBase Diagram…

xyz.gif
Diagram A-2 User Data Diagram…
d. The Data Diagram above will serve as my picture to use when I create the Entity in the XERP.Server.DAL.UserDAL project…
III. Create the XERP.Server.DAL Project…(important to note throughout the creation process I will refer to Xxx in my instance I am creating the SystemUser module so my Xxx would be SystemUser…)
a. Open up the XERP.sln Solution…
b. Within the Solution Right Click on the Server/Server.DAL Solution Folder
i. Select AddNew Project
A-3.png
Diagram A-3 Visual Studio Empty Project Creation...
ii. Select Empty Project
iii. Name it XERP.Server.DAL.xxxDAL
iv. Change the location to be …\XERP\XERP.Server\XERP.Server.DAL
v. Click OK…
c. Add required project reference/s
i. Within the newly created project right click on the Reference folder
1. Select Add Reference
2. From the Projects Tab select the XERP.Server.DAL
A-4.png
Diagram A-4
3. Click Ok the required project reference is now added…
4. The project reference added will be used later by the DALUtility.cs Class
5. To deliver the Base SQL Server Connection string…
d. Add the SharedAssemblyInfo.cs to the newly created project
i. Right click on the newly created project.
ii. Select AddExisting Item
iii. Navigate to the …/XERP folder and then highlight the SharedAssemblyInfo.cs
A-5.png
Diagram A-5 Add SharedAssemblyInfo.cs as a linked file
iv. We need to add this as a shared file…
a. Click on the down arrow part of the Add button…
b. It will display a dropdown select Add As Link from the drop down…
A-6.png
Diagram A-6 DAL Project with newly added SharedAssemblyInfo.cs as a linked file…
c. After you are done adding you will see it as above with the little arrow in the left corner of the SharedAssemblyInfo.cs
d. This is telling us it is linked file…
e. All XERP projects have this linked file to allow us to set assembly properties from a single location…
f. A very standard .net practice…
v. Check/Set Project Properties…
1. Right Click on the newly created DAL project and select Properties from the right clicked context menu…
A-7.png
Diagram A-7 DAL Project Properties Set Up…
2. Change the Output Type dropdown to Class Library.
3. Double check the Assembly Name and the Default namespace and make sure they match the XERP DAL nomenclature…
a. XERP.Server.DAL.xxxDAL
4. Click the Assebly Information Button
a. Add the Title: make it the same as the Assembly Name and Default NameSpace…
A-8.png
Diagram A-8 Assembly Information Dialogue…
5. The process above will generate an AsseblyInfo.cs file…
a. From within your solution explorer locate the newly created AssemblyInfo.cs file and open it up as below…
A-9.png
Diagram A-9 AssemblyInfo.cs before XERP required edits…
b. The SharedAssemblyInfo.cs we added earlier will trump and globalize some of the assembly properties…
c. So we will remove these properties from the AssemblyInfo.cs file; remove the following…
[assembly: AssemblyCompany("A Services, Inc")]
[assembly: AssemblyProduct("XERP.Server.DAL.XxxDAL.Properties")]
[assembly: AssemblyCopyright("Copyright © Services, Inc 2012")]

					[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

A-10.png
Diagram A-10 AssemblyInfo.cs after XERP required edits…
d. Ending up with the above…
i. Any commented lines done with // can be left or kept makes no difference as they are merely comments…
e. Look at the SharedAssemblyInfo.cs as you will then see that it is taking care of the assembly properties that we just removed…
A-11.png
Diagram A-11 SharedAssemblyInfo.cs file...
e. Set Build Properties…
i. From the Properies Dialogue select the Build Tab
ii. Select All Configurations from the Configuration: Dropdown…
iii. In the Output Path: TextBox paste in the following…
1. ..\..\XERPServerBuild\bin\
A-12.png
Diagram A-12 DAL Properties Build Tab Output Path setting…
iv. Setting the Build Output Path will allow all of the separate projects to build their output to a centralized location that can easily be cumulated and x-copied to a target production server…
IV. Add an Entity to the newly created DAL project…
a. Using the data diagram (Diagram A-2) as your visual…
i. This will stipulate the tables we will add to our entity…
b. Right click on the newly created DAL project…
i. AddNew Item
ii. Type Entity in the right corner to emulate a search
iii. Select the ADO.NET Entity Data Model
iv. Name it Xxx.edmx
v. I am creating the User DAL Project so I have named it SystemUser.edmx
vi. Substitute the xxx for DAL Name you are creating the entity for…
A-13.png
Diagram A-13 Add Entity Dialogue…
vii. After selecting the ADO.Net Entity Data Model then click the Add button…

A-14.png
Diagram A-14 Entity Data Model Wizard Dialogue…
viii. Select Generate from database and then click Next button…
A-15.png
Diagram A-15 Entity Choose Your Data Connection Dialogue…
ix. Make sure the Save entity connection settings in App.Config As: checkbox is checked…
x. Change it to be XxxEntities.
xi. Click the Next button…
A-16.png
Diagram A-16 Entity Database Object selection Dialogue…
xii. Expand the Tables node and select all the tables that you included in the database diagram you created from Diagram A-2.
xiii. After selecting the tables to be included then accept the checkbox defaults and Model Namespace: defaults and click the Finish Button…
1. We do not change the Defualt Namespace as it is overridden and defaulted to the one we set up earlier in the Project Properties section…
2. It will end up being XERP.Server.DAL.xxxDAL i.e. the same as the properties we set in the Project Properties section for default namespace…
3. Lastly we can delete the App.Config that got generated as we do not need it…
A-17.png
Diagram A-17 DALxxx.edmx entity Diagram…
A-18.png
Diagram A-18 xxx.Designer.cs (Entities .edmx auto generated code behind)

c. Configure Entity Connection to XERP standards…
i. Entity default connections are not appropriate for XERP as it would produces 100’s of separate SQL config settings.
ii. Causing a nightmare every time you wanted to switch db’s…
iii. So we add a DAL Utility class to strip out the common SQL connection string and the more localized meta-string that entity requires for defining schema and what not…
iv. Right Click on the newly created DAL project
1. Select AddClass
a. Name it DALUtility.cs
2. Within the Namespace {} brackets paste in the following snippet…
3. Add the following namespace…
a. using System.Data.EntityClient;
//substitute Xxx for your Object name; The object name for this tutorial is SystemUser…
    public class DALUtility
    {
        public const string _metadataString = @"res://*/Xxx.csdl|res://*/Xxx.ssdl|res://*/Xxx.msl";

        private EntityConnectionStringBuilder _entityBuilder = new EntityConnectionStringBuilder();
        public EntityConnectionStringBuilder EntityBuilder
        {
            get 
            {
                XERP.Server.DAL.DALConfig dalConfig = new XERP.Server.DAL.DALConfig();
                _entityBuilder.Provider = dalConfig.ProviderName;
                _entityBuilder.ProviderConnectionString = dalConfig.BaseSQLConnectionString;
                _entityBuilder.Metadata = _metadataString;
                return _entityBuilder; 
            }
        }

        public string EntityConectionString
        {
            get { return EntityBuilder.ConnectionString; }
        }

        public DALUtility()
        {

        }
    }
A-19.png
Diagram A-19 DAL Utility Class After Xxx Replacement…
v. When you paste it in if you did not add the using System.Data.EntityClient you will get some squiggly red lines
1. Hover over one of them; A menu will appear
2. From the menu select using System.Data.Entity.Client
V. Add Entity Extension Method Class…
a. In the case that the entity will be modified in the future we want to create a partial class of the entity that we can modify and persist…
b. Right click on the newly created DAL project
i. AddClass
A-20.png
Diagram A-20 Add Entity Extension Class…
c. Name it Xxx.Designer.Extension.cs
d. Click the Add Button…
e. Paste in the code below …
f. Replace Xxx with your Project Name i.e mine is SystemUser
g. Include any additional tables where you will want to define schema in order to use the XERP MaxLength property…
h. As you can see if you browse the code below there is GetMetaData Method defined
i. For the Main Object SystemUser
ii. The Type Object SystemUserType
iii. And the Code Object SystemUserCode
iv. So if there are any additional tables in the entity that will require client side Editing you will
v. Want to make sure to include them as well… The meta data will allow us to set max field lenghths in the xaml...
using System;
using System.Collections.Generic;
using System.Linq;
using XERP.Server.DAL.XxxDAL;
using System.Data.Metadata.Edm;
//namespace XERP.Server.DAL.XxxUserDAL
//{

//}

//we use the extension Method it allows to extend methods to existing entity objects...
//so that as long as use add the using ExtensionMethods you can utilize the methods below with a . reference...
//as if the the methods are part of the existing objects that they are referenced to by the this declaration
//in the parameter...
namespace ExtensionMethods
{
    public static class MyExtensions
    {
        public static string GetPropertyValue(this Xxx myObj, string propertyName)
        {
            var propInfo = typeof(Xxx).GetProperty(propertyName);

            if (propInfo != null)
            {
                return propInfo.GetValue(myObj, null).ToString();
            }
            else
            {
                return string.Empty;
            }
        }
 
        public static List<Temp> GetMetaData(this Xxx entityObject)
        {
            XERP.Server.DAL.XxxDAL.DALUtility dalUtility = new DALUtility();
            List<Temp> tempList = new List<Temp>();
            int id = 0;
            using (XxxEntities ctx = new XxxEntities(dalUtility.EntityConectionString))
            {

                var c = ctx.Companies.FirstOrDefault();
                var queryResults = from meta in ctx.MetadataWorkspace.GetItems(DataSpace.CSpace)
                                                        .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType)
                                   from query in (meta as EntityType).Properties
                                           .Where(p => p.DeclaringType.Name == entityObject.GetType().Name)
                                   select query;

                if (queryResults.Count() > 0)
                {
                    foreach (var queryResult in queryResults.ToList())
                    {
                        Temp temp = new Temp();
                        temp.ID = id;
                        temp.Name = queryResult.Name.ToString();
                        temp.ShortChar_1 = queryResult.TypeUsage.EdmType.Name;
                        if(queryResult.TypeUsage.EdmType.Name == "String")
                        {
                            temp.Int_1 = Convert.ToInt32(queryResult.TypeUsage.Facets["MaxLength"].Value);
                        }
                        temp.Bool_1 = false; //we use this as a error trigger false = not an error...
                        tempList.Add(temp);
                        id++;
                    }
                }
            }
            return tempList;
        }

        //All senior tables(Companies, Parts, Orders, ect...) tend to have a generic table called TableNameTypes 
        //i.e. XxxTypes PartTypes, OrderTypes...
        //So this will constitute the meta data for that Type table...
        //Xerp attempts to use generic naming where possible to allow for cloning...
        public static List<Temp> GetMetaData(this XxxType entityObject)
        {
            XERP.Server.DAL.XxxDAL.DALUtility dalUtility = new DALUtility();
            List<Temp> tempList = new List<Temp>();
            int id = 0;
            using (XxxEntities ctx = new XxxEntities(dalUtility.EntityConectionString))
            {

                var c = ctx.XxxTypes.FirstOrDefault();
                var queryResults = from meta in ctx.MetadataWorkspace.GetItems(DataSpace.CSpace)
                                                        .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType)
                                   from query in (meta as EntityType).Properties
                                           .Where(p => p.DeclaringType.Name == entityObject.GetType().Name)
                                   select query;

                if (queryResults.Count() > 0)
                {
                    foreach (var queryResult in queryResults.ToList())
                    {
                        Temp temp = new Temp();
                        temp.ID = id;
                        temp.Name = queryResult.Name.ToString();
                        temp.ShortChar_1 = queryResult.TypeUsage.EdmType.Name;
                        if (queryResult.TypeUsage.EdmType.Name == "String")
                        {
                            temp.Int_1 = Convert.ToInt32(queryResult.TypeUsage.Facets["MaxLength"].Value);
                        }
                        temp.Bool_1 = false; //we use this as a error trigger false = not an error...
                        tempList.Add(temp);
                        id++;
                    }
                }
            }
            return tempList;
        }

        //All senior tables(Companies, Parts, Orders, ect...) tend to have a generic table called TableNameCodes 
        //i.e. XxxCodes PartCodes, OrderCodes...
        //So this will constitute the meta data for that Code table...
        //Xerp attempts to use generic naming where possible to allow for cloning...
        public static List<Temp> GetMetaData(this XxxCode entityObject)
        {
            XERP.Server.DAL.XxxDAL.DALUtility dalUtility = new DALUtility();
            List<Temp> tempList = new List<Temp>();
            int id = 0;
            using (XxxEntities ctx = new XxxEntities(dalUtility.EntityConectionString))
            {

                var c = ctx.XxxCodes.FirstOrDefault();
                var queryResults = from meta in ctx.MetadataWorkspace.GetItems(DataSpace.CSpace)
                                                        .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType)
                                   from query in (meta as EntityType).Properties
                                           .Where(p => p.DeclaringType.Name == entityObject.GetType().Name)
                                   select query;

                if (queryResults.Count() > 0)
                {
                    foreach (var queryResult in queryResults.ToList())
                    {
                        Temp temp = new Temp();
                        temp.ID = id;
                        temp.Name = queryResult.Name.ToString();
                        temp.ShortChar_1 = queryResult.TypeUsage.EdmType.Name;
                        if (queryResult.TypeUsage.EdmType.Name == "String")
                        {
                            temp.Int_1 = Convert.ToInt32(queryResult.TypeUsage.Facets["MaxLength"].Value);
                        }
                        temp.Bool_1 = false; //we use this as a error trigger false = not an error...
                        tempList.Add(temp);
                        id++;
                    }
                }
            }
            return tempList;
        }
    }
}

Service Creation
VI. Add Service Project…
a. Right Click on the Server.Service Folder and Select AddNew Project
b. Select ASP.NET Empty Web Application…
c. Name it XERP.Server.Service.XxxService
d. Select the C:\XERP\XERP.Server\XERP.Server.Service\ Folder location…
B-1.png
Diagram B-1 Create Service Project…
e. Add the shared AssemblyInfo.cs as a linked file…
i. refer to the directions and Diagram A-5 Add SharedAssemblyInfo.cs as a linked file
ii. As all projects within XERP will required the SharedAssemblyInfo.cs file…
f. Set Service Project Properties…
i. Right Click on the newly created Service Project and select Properties…
ii. Select the Application Tab…
1. Check the Assembly Name and Default Namespace
a. Make sure they are both XERP.Server.Service.XxxService
B-2.png
Diagram B-2 Service Application Properties
g. Click the Assembly Information Button…
i. Provide the Title and Description; same as the Assembly Name…
B-3.png
Diagram B-3
ii. Delete the global Assembly properties as they will be provided by the Shared
1. Review steps near diagram A-9 and A-10 the same steps will apply for all XERP projects
iii. Select the Build Tab…
1. Select the Debug from Configuration: dropdown…
a. Confirm the Output Path to be bin\
b. We do this to allow the service to be run in debug mode…
2. Change the Configuration: dropdown to Release…
a. Set the Output Path to be ..\..\XERPServerBuild\bin\
b. We do this to consolidate are build files to be in a shared release folder…
B-4.png
Diagram B-4 Service Project Debug Build Output Path…
B-5.png
Diagram B-5 Service Project Release Build Output Path…
iv. Select The Web Tab…
1. Select Specific Page from the Start Action and provide XxxDataService.svc in the adjacent textbox
a. We will create this later…
2. From the Servers Section select Specific Port and give it a unique port number…
a. Check all the current services in the solution and look for the next available port assignment…
b. My last port number used was 1203 so I will opt to use 1205 for no better reason then to
c. Start using port numbers that are divisible by 5…
d. So if the last port number was 1205 I would then to proceed to use 1210 and so on…
e. Remember this Port Number as we will utilize in the Domain Project…
f. Select the Specific port radio button and provide your unique port number and note it as we will use it later…
B-6.png
Diagram B-6
h. Add Required Project References
i. On the newly created service project right click on the References folder
1. From the Projects Tab
2. Select XERP.Server.DAL.XxxDAL
B-7.png
Diagram B-7 Add DAL Project Reference replace SystemUserDAL with XxxDAL…
i. Add WCF Data Service…
i. Right Click on the newly created Service
1. Select AddNew Item
B-8.png
Diagram B-8 Adding WCF Data Service
2. Name it XxxDataService.svc
3. Open up the generated XxxDataService.svc.cs class…
B-9.png
Diagram B-9 WCF Data Service generated class before providing the TODO:
4. Replace /* TODO: put your data source class name here */
5. With XxxEntities
6. Once added hover over the XxxEntities and select the blue line and add the necessary using statement…
B-10.png
Diagram B-10 Add DAL Project Using Statement…
7. Here is the XxxDataService.cs class code in its entirety…
8. Massage the code base to fit your Xxx…
9. The easiest thing to do is paste in the using statements…
10. Then paste in the class from start { to end }
11. Then find and replace on the current document
12. Replace SystemUsers with Xxx/s or ies
a. If your plural is not just an addition of an s you will have to modify plurality accordingly…
b. If it is standard plurality as just adding an S then you can
i. Skip step 12
ii. And just do step 13 as it will replace the singlularity and plurality
iii. At the same replace of the singularity as it is just an additional s…
13. Replace SystemUser with Xxx
using System;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using XERP.Server.DAL.SystemUserDAL;
using System.ServiceModel.Web;
using System.Collections.Generic;
using ExtensionMethods;

namespace XERP.Server.Service.SystemUserService
{
    public class SystemUserDataService : DataService< SystemUserEntities >
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("*", EntitySetRights.All);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
            //I noticed when setting page size it would always limit my expand payload to 1
            //I have elected to disable paging...
            //config.SetEntitySetPageSize("*", 50);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
        }
        //The procedure below uses the Temp table as following...
        //ID item count key id...
        //Name MetaData FieldName
        //Int_1 String Field Max Length
        //Bool_1 Error Flag
        [WebGet]
        public IQueryable<Temp> GetMetaData(string tableName)
        {
            switch (tableName)
            {
                case "SystemUsers":
                    SystemUser SystemUser = new SystemUser();
                    return SystemUser.GetMetaData().AsQueryable();
                case "SystemUserTypes":
                    SystemUserType SystemUserType = new SystemUserType();
                    return SystemUserType.GetMetaData().AsQueryable();
                case "SystemUserCodes":
                    SystemUserCode SystemUserCode = new SystemUserCode();
                    return SystemUserCode.GetMetaData().AsQueryable();
                default: //no table exists for the given tablename given...
                    List<Temp> tempList = new List<Temp>();
                    Temp temp = new Temp();
                    temp.ID = 0;
                    temp.Int_1 = 0;
                    temp.Bool_1 = true; //bool_1 will flag it as an error...
                    temp.Name = "Error";
                    temp.ShortChar_1 = "Table " + tableName + " Is Not A Valid Table Within The Given Entity Collection, Or Meta Data Was Not Defined For The Given Table Name";
                    tempList.Add(temp);
                    return tempList.AsQueryable();
            }
        }

        [WebGet]
        public IQueryable<SystemUser> RefreshSystemUser(string autoIDs)
        {
            var query = from val in autoIDs.Split(',')
                        select long.Parse(val);
            XERP.Server.DAL.SystemUserDAL.DALUtility dalUtility = new DALUtility();
            var context = new SystemUserEntities(dalUtility.EntityConectionString);

            var queryResult = (from q in context.SystemUsers
                               where query.Contains(q.AutoID)
                               select q);

            return queryResult;
        }

        [WebGet]
        public IQueryable<SystemUserType> RefreshSystemUserType(string autoIDs)
        {
            var query = from val in autoIDs.Split(',')
                        select long.Parse(val);
            XERP.Server.DAL.SystemUserDAL.DALUtility dalUtility = new DALUtility();
            var context = new SystemUserEntities(dalUtility.EntityConectionString);

            var queryResult = (from q in context.SystemUserTypes
                               where query.Contains(q.AutoID)
                               select q);

            return queryResult;
        }

        [WebGet]
        public IQueryable<SystemUserCode> RefreshSystemUserCode(string autoIDs)
        {
            var query = from val in autoIDs.Split(',')
                        select long.Parse(val);
            XERP.Server.DAL.SystemUserDAL.DALUtility dalUtility = new DALUtility();
            var context = new SystemUserEntities(dalUtility.EntityConectionString);

            var queryResult = (from q in context.SystemUserCodes
                               where query.Contains(q.AutoID)
                               select q);

            return queryResult;
        }

        protected override SystemUserEntities CreateDataSource()
        {
            try
            {
                XERP.Server.DAL.SystemUserDAL.DALUtility dalUtility = new DALUtility();
                var context = new SystemUserEntities(dalUtility.EntityConectionString);

                //test it...
                //GetMetaData("SystemUsers");
                //IQueryable<SystemUser> SystemUserQuery = (from c in context.SystemUsers
                //                                    select c);

                //foreach (SystemUser cc in SystemUserQuery)
                //{
                //    string s = cc.Name.ToString();
                //}
                //SystemUser SystemUser = new SystemUser();
                //IQueryable<SystemUser> SystemUserQuery = Refresh("5,6");
                return context;
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
    }
}
j. Add the following to the web configs <system.web> tag…
<httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0"/>
<pages validateRequest="false"/>
B-11.png
Diagram B-11
i. This will allow for strange characters such as <, > or * to be queried across the DataService…
ii. Of course it does allot for injection attacks to your WCF data service…
iii. If you plan on keeping it an intranet service this is completely acceptable…
iv. If not you should not do this and just make sure you are not querying for special characters…
v. It is important to note all XERP Services once deployed will share a single Web Config
1. So good and bad…
2. You can set the web config per installed instance and it will adhere to all the Services Used in XERP…
3. It is recommended to allow special characters as the menu item module for one uses a * to
a. Represent all menu items…
b. So if it is not set in this manner the MenuSecurities service will error out…
k. Test the newly created data service…
i. Set the newly created service as the start up project…
ii. Run the application from debug mode…
1. This will give your restful local query URL…
iii. You now should have your restful service…
iv. And can test it using restful queries…
B-12.png
Diagram B-12 Testing your WCF Data Service…
B-13.png
Diagram B-13 http://localhost:1205/SystemUserDataService.svc/SystemUsers Restful User Query Example…

CLIENT SIDE CREATION

Domain Creation – yes the domain is client side…
VII. Add Domain Project…
a. Right Click on the Domain Folder and Select AddNew Project
b. Select Empty Project…
c. Name it XERP.Domain.XxxDomain
d. Select the C:\XERP\XERP.Domain\ Folder location…
C-1.png
Diagram C-1 Create Domain Project…
e. Add the shared AssemblyInfo.cs as a linked file…
i. refer to the directions and Diagram A-5 Add SharedAssemblyInfo.cs as a linked file
ii. As all projects within XERP will required the SharedAssemblyInfo.cs file…\
f. Set Domain Project Properties…
i. Right Click on the newly created Domain Project and select Properties…
ii. Select the Application Tab…
1. Check the Assembly Name and Default Namespace
a. Make sure they are both XERP.Domain.XxxDomain
b. Change the Output type: to be Class Library
C-2.png
Diagram C-2 Domain Application Properties
g. Click the Assembly Information Button…
i. Provide the Title and Description; same as the Assembly Name…
C-3.png
Diagram C-3
ii. Delete the global Assembly properties as they will be provided by the Shared
1. Review steps near diagram A-8 and A-9 the same steps will apply for all XERP projects…
iii. Select the Build Tab…
1. Select the All Configurations from the Configuration: dropdown…
2. Set the Output Path to be ..\XERPDomainBuild\bin\
3. We do this to consolidate are build files to a shared release file…
C-4.png
Diagram C-4 Domain Project Debug Build Output Path…
h. Add Required Project References
i. On the newly created domain project right click on the References folder
1. From the Projects Tab
2. Select XERP.Client
C-5.png
Diagram C-5 Add XERP.Client Project Reference…
VIII. Add the domain logic…
a. There is a lot of code that is required to support the domain logic…
b. We can leverage the SecurityGroupDomain Logic…
c. Expand the XERP.Domain.SecurityGroup Domain project…
i. Copy the XERP.Domain.SecurityGroup Services folder and all its contents…
ii. Paste the contents in to your newly created Domain Project…
d. We will change all .cs Files from SecurityGroup to Xxx…
C-6.png
Diagram C-6
e. We will do a mass find and replace for each of the SecurityGroup Domain objects we pasted in…
f. Do a mass replace as below for each of the service classes you pasted in…
g. We can select Entire Solution from the Look In: option…
h. Again we should take care of plural instances first…
i. securityGroups with xxxs/ies depending on your plurality…
C-7.png
Diagram C-7
ii. SecurityGroups with Xxxs/ies depending on your plurality…
C-8.png
Diagram C-8

iii. SecurityGroup with Xxx
C-9.png
Diagram C-9
iv. securityGroup with xxx
v. You can use Replace All
1. but it is important to note that their may be a xxx that is a field definition…
2. Or something to that effect that may not require to be modified…
3. When you are done with each class it will or should have no errors…
4. As well their may be instances in the class where only Xxx is found and replaced…
5. Take away here is that we need redefine the Object from Copied SecurityGroup to Xxx
a. Maintaining its camel case or plurality where and when required…
vi. Before we do a build we will need to bring in the Service Reference…
1. The reason we do the service reference last is it has a bunch of
2. Client side references that we may whack in our mass replace of SecurityGroup…
3. So doing it after the mass replace is optimal….
4. And we can not build until we put it in as it is the link back to the entity model…
IX. Add the Service Reference…
a. Right click on the new Domain Project’s Reference Folder
i. Select Add Service Reference…
C-10.png
Diagram C-10
ii. Click the discover button
1. It will display all the services available to the solution…
2. Select the XxxDataService.svc
a. This is the service we created in the Service Creations steps…
3. Change the namespace to XxxDataService
4. Click OK to generate the service reference…
C-11.png
Diagram C-11
5. You will then see the XxxDataService in the Solution Explorer as above…
iii. Deal with any left over errors…
iv. Modify the jackknife search method if required…
1. Look for this method substituting Xxx with your object name… GetXxxs(Xxx xxxQueryObject)
2. The fields within the search object may match and may just be a matter of adding additional ones…
3. The method below is the jack knife search method…
C-12.png
a. It accepts the object it is searching for and then has a case statement…
b. Any string fields provided in the parameter object that are not null…
c. Will Be searched using a starts with clause for each field provided in the parameter object…
Any fields in the table that will require a search should be added to the case...
d. So with that said in order for it to function as expected you will have to add a case for each string in the object…
e. Or you can comment out any of the erroneous cases and move on…
f. Important to note this search jack knife method will only work as well as you code for each string field in the object…
g. Deal with any one off errors left over logically using standard .net debugging logic…
C-13.png
Diagram C-13 Modify Port In ServiceUtility.cs Class

X. Modify the ServiceUtility.cs
a. Open up the ServiceUtility.cs from the services folder…
b. Modify the Port Number to match what you set it to be in the WCD Data Service Project…

CLIENT WPF CREATION
XI. Add Client WPF Project…
a. Right Click on the Client.WPF Folder and Select AddNew Project
b. Select WPF Application Project…
c. Name it XERP.Client.WPF.XxxMaintenance
d. Select C:\XERP\XERP.Client\XERP.Client.WPF\ Folder location…
e. Click OK to add the project to the solution…
D-1.png
Diagram D-1 Create WPF Project…
f. Add the shared AssemblyInfo.cs as a linked file…
i. refer to the directions and Diagram A-5 Add SharedAssemblyInfo.cs as a linked file
ii. As all projects within XERP will required the SharedAssemblyInfo.cs file…
g. Set WPF Project Properties…
i. Right Click on the newly created WPF Project and select Properties…
ii. Select the Application Tab…
1. Check the Assembly Name and Default Namespace
a. Make sure they are both XERP.Client.WPF..xxxMaintenance
D-2.png
Diagram D-2 WPF Application Properties
h. Click the Assembly Information Button…
i. Provide the Title and Description; same as the Assembly Name…
D-3.png
Diagram D-3
ii. Review steps near diagram A-8 and A-9 to resolve global and project level assembly properties
1. the same steps will apply for all XERP projects…
iii. Select the Build Tab…
1. Select All Configurations from the Configuration: dropdown…
2. Set the Output Path to be ..\..\XERPClientBuild\Bin\
3. We do this to consolidate are build files to a shared release folder…
D-4.png
Diagram D-4 WPF Project Debug Build Output Path…
i. Add Required Project References
i. On the newly created domain project right click on the References folder
1. From the Projects Tab
2. Select
a. SimpleMvvmToolkit-WPF
b. XERP.Client
c. XERP.Client.WPF
d. XERP.Client.WPF.Login
e. XERP.Domain
f. XERP.Domain.XxxDomain
D-5.png
Diagram D-5 Add WPF Project Reference…
j. As well add the following .net References
i. Mircrosoft.Expression.Interactions
ii. System.Windows.Interactivity
iii. System.Data.Services.Client
XII. Copy in SecurityGroup WPF content…
a. There is a lot of POCO and XAML that creates and supports the maintenance screens…
b. Select the SecurityGroupMaintenance Project
c. Select then entire content from the Locators folder to the TypeSearchWindow.xaml…
d. Exclude the SharedAssemblyinfo.cs
e. And copy it to your clipboard…
D-6.png
Diagram D-6 Copy WPF Content to your Clipboard
f. Paste the Clipboard contents in to your newly created WPF Project…
D-7.png
Diagram D-7 Click Yes Overwrite App.XAML…
g. When you get this message click Yes…
i. Do a project wide Replace make sure it is Case Sensative…
1. SecurityGroups to Xxxs/ies whatever the plurality requires…
2. securityGroups to xxxs/ies whatever the plurality requires…
3. SecurityGroup to Xxx
4. securitygroup to xxx
ii. Build the project deal with any one off errors that may spring up…
h. Add Search Tokens for your Main Maintenance UI, Its Code Maintenance UI and its Type Maintenance UI…
i. Open up the Utility.CS class from the XERP.Client Project…
ii. Find the public enum MessageTokens
1. Add your tokens as required…
2. For System User we have
a. Main Maintenance Screen
b. Type Maintenance Screen
c. Code Maintenance Screen
3. Each of these screens allows for a search the search functionality opens up a Search screen
a. The tokens we add here allow for the unique token for each search to identify itself to the screen that invoked the search…
b. Allowing the search view to communicate its result back to the view that invoked the search…
D-8.png
Diagram D-8 Add Search Tokens to Utility.cs Class
XIII. Back door in the Menu Items that will allow the form/s to be opened from the main menu…
a. Create an ExecutableProgram record for each of the WPF Windows in your project…
D-9.png
Diagram D-9 Add ExecutableProgram Records…
b. Create MenuItems for any parent folder where you want your Executable Programs to show up on…
D-10.png
Diagram D-10 Add MenuItems where ever you want Executable Programs to be displayed on the menu…
XIV. Add the Maintenacne Window/s to the WindowLocator Class
a. Open up the …WPF.MainMenu Project…
b. Add the XERP.Client.WPF.Xxx project reference to the WPF.MainMenu Project…
c. Open up the WindowLocator.cs class inside the Locators folder…
d. Add your ExecutableProgram Names to the _executableProgramEnum…
i. As you can see I add the SystemUserMaintenance Executable Programs…
D-11.png
Diagram D-11 Add your ExecutablePrograms to the MainMenu WindowLocator.cs Class _executableProgram Enum enumerator…
e. Add a case for each of your Executable Programs…
D-12.png
Diagram D-12 Add Case Statements for each of your Executable Programs…

Last edited Sep 25, 2012 at 2:30 PM by MattPaulson, version 23

Comments

No comments yet.