Forum Posts

jcorder
Jun 10, 2022
In Windows Forms
I'm in the process of moving from MM 2010 to MM 2019. It's going as well as can be expected. The changes have been minor... until I turned on security. I got a null reference error from deep in the bowels of MM. It turns out that the error was thrown in mmSecurityManager.GetUserRoleDefaultFormAccess(Guid securityID, DataSet dsRoleSecurity, DataSet dsUserRoles, mmSecurityAccessFormLevel level). The initial cause was when I called GetAccessLevelForm(object userPK, Guid securityID) and default parameters were created by MM and it was sent to the more precise implementation of GetAccessLevelForm(). It turns out, instead of getting the UserRole infomration, it passed a null. public override mmSecurityAccessFormLevel GetAccessLevelForm(object userPK, Guid securityID) { // Original code //return GetAccessLevelForm(userPK, securityID, // oUserSecurity.GetUserSecurityByPK(userPK), // oRoleSecurity.GetRolesSecurityByUser(userPK), // null); // REALLY? just send a null??? // Fill UserRoles with roles for specified user UserRoles oUserRole = new UserRoles(); // This is just a helper I use to make it easy to get data by foreign Key - use your favorite technique oUserRole.GetDataByFK("UserFK", (int)userPK, oRole.TableName); return GetAccessLevelForm(userPK, securityID, oUserSecurity.GetUserSecurityByPK(userPK), oRoleSecurity.GetRolesSecurityByUser(userPK), oUserRole.DataSet); // Now we have real data to send. } Turns out the problem was not quite solved yet... It turns out that there is an error in GetUserRoleDefaultFormAccess. protected override mmSecurityAccessFormLevel GetUserRoleDefaultFormAccess(Guid securityID, DataSet dsRoleSecurity, DataSet dsUserRoles, mmSecurityAccessFormLevel level) { mmSecurityAccessFormLevel result = level; DataRowCollection rows = dsUserRoles.Tables[oRole.TableName].Rows; foreach (DataRow item in rows) { // oRole.PrimaryKey is RolePK - that's not what is in UserRoles //DataRow[] array = dsRoleSecurity.Tables[0].Select( // oRoleSecurity.SecurityFKField + " = '" + securityID.ToString() + "' AND " + // oRoleSecurity.RoleFKField + " = " + item[oRole.PrimaryKey].ToString()); // Change oRolePrimaryKey (RolePK) to oRoleSecurity.RoleFKFiield (RoleFK) DataRow[] array = dsRoleSecurity.Tables[0].Select( oRoleSecurity.SecurityFKField + " = '" + securityID.ToString() + "' AND " + oRoleSecurity.RoleFKField + " = " + item[oRoleSecurity.RoleFKField].ToString()); if (array.Length == 0) { result = mmAppBase.DefaultSecurityAccessFormLevel; break; } } return result; } Hopefully this will help someone turning on security. Jeff
0
0
11
jcorder
Mar 23, 2022
In Windows Forms
In converting my mm 2010 projects to mm 2019, I have run across my code implementing mmFactoryDesktop. I tried using mmFactory, I get an error: System.InvalidCastException: 'Unable to cast object of type 'Ambit.POS.Main.Factory' to type 'OakLeaf.MM.Main.Windows.Forms.ImmFactoryWinForms'.' I can't find any references in the help file to ImmFactoryWinForms. I have included MM.NET Framework Windows Forms 2019, but I don't can't find the factory I need to override. Thanks, Jeff
0
3
19
jcorder
Jun 22, 2021
In Entity Framework
I have a .Net 5.0 project and I'm getting an error on mmFactory in AAppTest.cs Here are the particulars: Data Project using Framework .Net 5 (MM Standard) MM Assemblies: Oakleaf.MM2019.Framework.EF.Full Oakleaf.MM2019.Framework.EF.Standard Oakleaf.MM2019.Framework.Standard Oakleaf.MM2019.Interfaces.Standard In AAppTest.cs An error attached to mmFactory: Error CS0012 The type 'mmFactoryStandard' is defined in an assembly that is not referenced. You must add a reference to assembly 'OakLeaf.MM2019.Framework.EF, When I Add Oakleaf.MM2019.Framework.EF, I get 2000+ errors, most of which are some variant of Error CS0433 The type 'mmBusinessRule' exists in both 'OakLeaf.MM2019.Framework.EF.Standard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=0e0547488df5a428' and 'OakLeaf.MM2019.Framework.EF, Version=4.8.1.0, Obviously, Framework.EF.Standard is a replacement for Framework.EF and both should not be inlcuded in the same project (which was my original assumption). It looks like mmFactoryStandard is not defined in Oakleaf.MM2019.Framework.EF.Standard and should be. Or, I should be using something else. Or I’m doing something wrong (most likely). Thanks for your help.
0
0
23
jcorder
Nov 19, 2020
In Windows Forms
I purchased the updated MM product (I was using 2010). I figured I'd have some serious changes to get it working. I Installed the product and had a lot of errors different from when I was working on the demo version. I thought the best idea would be to go through the Jumpstart, then compare what is different. However, when I tried, there are no templates installed. I went through the list of changes the installation is supposed to make and the files installed and they all appear to be in place. Any ideas on why I don't have any templates? Thanks, Jeff
0
3
38

jcorder

More actions