public void Update(Domain.Resource resource)
        {
            string sql = "UPDATE dbo.T_Resource SET [Name]=@NAME,[Address]=@ADDRESS,[Remark]=@REMARK,[Valid]=@VALID WHERE [Id]=@ID";

            using (var dbOperator = new DbOperator(Provider, ConnectionString)) {
                dbOperator.AddParameter("ID", resource.Id);
                dbOperator.AddParameter("NAME", resource.Name);
                dbOperator.AddParameter("ADDRESS", resource.Address ?? string.Empty);
                dbOperator.AddParameter("REMARK", resource.Remark ?? string.Empty);
                dbOperator.AddParameter("VALID", resource.Valid);
                dbOperator.ExecuteNonQuery(sql);
            }
        }
        public void Register(Guid subMenuId, Domain.Resource resource)
        {
            var sql = "INSERT INTO dbo.T_Resource ([Id],[Name],[Address],[Remark],[Valid],[Menu]) VALUES (@ID,@NAME,@ADDRESS,@REMARK,@VALID,@MENU)";

            using (var dbOperator = new DbOperator(Provider, ConnectionString)) {
                dbOperator.AddParameter("ID", resource.Id);
                dbOperator.AddParameter("NAME", resource.Name);
                dbOperator.AddParameter("ADDRESS", resource.Address ?? string.Empty);
                dbOperator.AddParameter("REMARK", resource.Remark ?? string.Empty);
                dbOperator.AddParameter("VALID", resource.Valid);
                dbOperator.AddParameter("MENU", subMenuId);
                dbOperator.ExecuteNonQuery(sql);
            }
        }
        private Domain.ResourceGroup GenerateResourceGroup(int rgIndex)
        {
            var resourceGroup = new Domain.ResourceGroup()
            {
                Code        = $"Seeded Resource Group {rgIndex}",
                Description = $"This Resource Group has been auto-generated - [Index: {rgIndex}]",
                IsPrivate   = new Random().Next(100) <= 50 ? true : false,
                Resources   = new List <Domain.Resource>()
            };

            for (int i = 0; i < new Random().Next(1, 20); i++)
            {
                var resource = new Domain.Resource()
                {
                    Key         = $"RG_{rgIndex}_{i}",
                    Description = $"This Resource has been auto-generated - [Index: {i}]",
                    Value       = new LocalizedValueObject(),
                    TenantId    = null
                };
                resource.Value.SetValue($"RG_{rgIndex}_{i} - EN Value", Transversal.Common.Localization.SupportedLanguages.Codes.en);
                resource.Value.SetValue($"RG_{rgIndex}_{i} - PT Value", Transversal.Common.Localization.SupportedLanguages.Codes.pt);
                resource.Value.SetValue($"RG_{rgIndex}_{i} - ES Value", Transversal.Common.Localization.SupportedLanguages.Codes.es);
                resource.Value.SetValue($"RG_{rgIndex}_{i} - FR Value", Transversal.Common.Localization.SupportedLanguages.Codes.fr);
                resourceGroup.Resources.Add(resource);

                if (resourceGroup.IsPrivate)
                {
                    var overridenEntityResource = new Domain.Resource()
                    {
                        Key              = $"RG_{rgIndex}_{i}",
                        Description      = $"This Resource has been auto-generated- [Index: {i}] [Overriden for tenant 1]",
                        Value            = new LocalizedValueObject(),
                        TenantId         = 1,
                        TenantlessEntity = resource
                    };
                    overridenEntityResource.Value.SetValue($"RG_{rgIndex}_{i} - EN Value [Overriden for tenant 1]", Transversal.Common.Localization.SupportedLanguages.Codes.en);
                    overridenEntityResource.Value.SetValue($"RG_{rgIndex}_{i} - PT Value [Overriden for tenant 1]", Transversal.Common.Localization.SupportedLanguages.Codes.pt);
                    overridenEntityResource.Value.SetValue($"RG_{rgIndex}_{i} - ES Value [Overriden for tenant 1]", Transversal.Common.Localization.SupportedLanguages.Codes.es);
                    overridenEntityResource.Value.SetValue($"RG_{rgIndex}_{i} - FR Value [Overriden for tenant 1]", Transversal.Common.Localization.SupportedLanguages.Codes.fr);
                    resourceGroup.Resources.Add(overridenEntityResource);
                }
            }

            return(resourceGroup);
        }