Exemplo n.º 1
0
 protected override void Act()
 {
     _actualResult = EdFiConventions.CreateResourceNamespace(
         "SchemaProperCaseName",
         "ResourceName",
         null,
         null,
         null,
         null);
 }
Exemplo n.º 2
0
 protected override void Act()
 {
     _actualResult = EdFiConventions.CreateResourceNamespace(
         "SchemaProperCaseName",
         "ResourceName",
         "ProfileNamespaceName",
         "ReadableWritableContext",
         null,
         "ExtensionSchemaProperCaseName");
 }
Exemplo n.º 3
0
        private string GetResourceClassTypeName(Resource resource, string profileName)
        {
            string resourceNamespace =
                EdFiConventions.CreateResourceNamespace(
                    resource,
                    GetProfileNamespaceName(profileName),
                    "_Writable");

            return($"{resourceNamespace}.{resource.Name}");
        }
        private string GetResourceTypeName(Resource resource, string profileName = null)
        {
            string resourceNamespace = EdFiConventions.CreateResourceNamespace(
                resource,
                profileName?.Replace('-', '_'),
                profileName == null
                    ? null
                    : "_Writable");

            return($"{resourceNamespace}.{resource.Name}");
        }
Exemplo n.º 5
0
        private string FormatResourceWriteModel(StandardizedResourceProfileData resourceData)
        {
            if (resourceData.Writable == null)
            {
                return(FormatNullWriteRequest(resourceData));
            }

            return(RemoveEdFiNamespacePrefix(
                       string.Format(
                           "{0}.{1}",
                           EdFiConventions.CreateResourceNamespace(
                               resourceData.Writable,
                               resourceData.ProfileNamespaceName,
                               resourceData.ProfileNamespaceName != null
                            ? "_Writable"
                            : null),
                           resourceData.Writable.Name)));
        }
Exemplo n.º 6
0
 protected override void Act()
 {
     EdFiConventions.CreateResourceNamespace("SchemaProperCaseName", "ResourceName", null, null, "ConcreteContext", null);
 }
Exemplo n.º 7
0
 protected override void Act()
 {
     EdFiConventions.CreateResourceNamespace(null, "TestResource", null, null, null, null);
 }
Exemplo n.º 8
0
        private string GetResourceClassTypeName(Resource resource)
        {
            string resourceNamespace = EdFiConventions.CreateResourceNamespace(resource);

            return($"{resourceNamespace}.{resource.Name}");
        }
Exemplo n.º 9
0
        private IEnumerable <object> CreateResourceContextModels(ResourceProfileData profileData)
        {
            // Create the context for the main resource
            var resourceContext = new
            {
                ResourceName             = profileData.ResourceName,
                ResourceClassesNamespace = EdFiConventions.CreateResourceNamespace(
                    profileData.ContextualRootResource,
                    profileData.ProfileNamespaceName,
                    profileData.ReadableWritableContext,
                    profileData.ConcreteResourceContext),
                ResourceClasses = CreateContextualResourceClasses(
                    profileData,
                    profileData.ContextualRootResource.FullName.Schema),
                IsAbstract = profileData.IsAbstract
            };

            if (resourceContext.ResourceClasses != ResourceRenderer.DoNotRenderProperty)
            {
                yield return(resourceContext);
            }

            // Process resources based on Ed-Fi standard resources for possible resource extensions
            if (profileData.ContextualRootResource.IsEdFiStandardResource)
            {
                // Get all the extension physical schema names present on the current resource model
                string[] extensionSchemaPhysicalNames =
                    !profileData.ContextualRootResource.IsEdFiStandardResource
                        ? new string[0]
                        : profileData.ContextualRootResource.AllContainedItemTypes
                    .Select(i => i.FullName.Schema)
                    .Except(
                        new[] { EdFiConventions.PhysicalSchemaName })
                    .ToArray();

                // Process each extension schema with an individual namespace
                foreach (string extensionSchemaPhysicalName in extensionSchemaPhysicalNames)
                {
                    string extensionSchemaProperCaseName = TemplateContext.DomainModelProvider.GetDomainModel()
                                                           .SchemaNameMapProvider
                                                           .GetSchemaMapByPhysicalName(extensionSchemaPhysicalName)
                                                           .ProperCaseName;

                    var extensionContext = new
                    {
                        ResourceName             = profileData.ResourceName,
                        ResourceClassesNamespace =
                            EdFiConventions.CreateResourceNamespace(
                                profileData.ContextualRootResource,
                                profileData.ProfileNamespaceName,
                                profileData.ReadableWritableContext,
                                profileData.ConcreteResourceContext,
                                extensionSchemaProperCaseName),
                        ResourceClasses = CreateContextualResourceClasses(
                            profileData,
                            extensionSchemaPhysicalName),
                        IsAbstract = profileData.IsAbstract
                    };

                    if (extensionContext.ResourceClasses != ResourceRenderer.DoNotRenderProperty)
                    {
                        yield return(extensionContext);
                    }
                }
            }
        }