Exemple #1
0
        /// <summary>
        /// This method verifies authorization for a repository level predicate, e.g. Create.
        /// </summary>
        /// <param name="authorizingPredicateUri">Predicate URI for a repository level, (which is NOT resource specific)
        /// predicate. e.g. Create</param>
        /// <param name="context">ZentityContext object</param>
        /// <returns>True if the current instance has permission for the given repository level predicate.</returns>
        public bool VerifyAuthorization(string authorizingPredicateUri, ZentityContext context)
        {
            #region Parameter Validation
            ValidateParameters(authorizingPredicateUri, context);
            #endregion
            try
            {
                IEnumerable <Relationship> relationships = context.Relationships
                                                           .Where(tuple => tuple.Subject.Id == this.Id &&
                                                                  tuple.Predicate.Uri == authorizingPredicateUri &&
                                                                  tuple.Object.Id == this.Id);

                if (relationships == null || relationships.Count() == 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception exception)
            {
                throw new AuthorizationException(Resources.VerifyAuthorizationException, exception);
            }
        }
 /// <summary>
 /// Fetches the specified resource type.
 /// </summary>
 /// <param name="resourceTypeFullName">Full name of resource type.</param>
 /// <param name="context"><see cref="ZentityContext" /> instance to fetch data with.</param>
 /// <returns>Resource type.</returns>
 public static ResourceType FetchResourceType(
     string resourceTypeFullName, ZentityContext context)
 {
     return(FetchResourceTypes(context)
            .Where(resourceType => resourceType.FullName.Equals(resourceTypeFullName,
                                                                StringComparison.OrdinalIgnoreCase)).FirstOrDefault());
 }
        /// <summary>
        /// Compares two specified resource types and returns an integer that indicates
        /// their relationship to one another in the inheritance heirarchy.
        /// </summary>
        /// <param name="resourceTypeFullNameA">The first resource type full name.</param>
        /// <param name="resourceTypeFullNameB">The second resource type full name.</param>
        /// <param name="context"><see cref="ZentityContext" /> instance to fetch data with.</param>
        /// <returns>A 32-bit signed integer indicating the relationship between the two
        /// Value Condition Less than zero resourceTypeFullNameB is derived from resourceTypeFullNameA.
        /// Value Condition Greater than zero resourceTypeFullNameA is derived from resourceTypeFullNameB.
        /// Zero, resourceTypeFullNameA and resourceTypeFullNameB have no relation.
        /// </returns>
        public static int CompareResourceTypes(
            string resourceTypeFullNameA, string resourceTypeFullNameB, ZentityContext context)
        {
            if (String.IsNullOrEmpty(resourceTypeFullNameA))
            {
                throw new ArgumentNullException("resourceTypeFullNameA");
            }
            if (String.IsNullOrEmpty(resourceTypeFullNameB))
            {
                throw new ArgumentNullException("resourceTypeFullNameB");
            }
            if (String.Equals(resourceTypeFullNameA, resourceTypeFullNameB))
            {
                return(1);
            }
            ResourceType typeA = FetchResourceType(resourceTypeFullNameA, context);
            int          value = FetchResourceDerivedTypes(typeA, context)
                                 .Where(resourceType => resourceType.FullName == resourceTypeFullNameB).Count();

            if (value > 0)
            {
                return(-1);
            }
            else
            {
                ResourceType typeB = FetchResourceType(resourceTypeFullNameB, context);
                value = FetchResourceDerivedTypes(typeB, context)
                        .Where(resourceType => resourceType.FullName == resourceTypeFullNameA).Count();
                if (value > 0)
                {
                    return(1);
                }
            }
            return(0);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ZentityAggregatedResource"/> class.
        /// </summary>
        /// <param name="id">id of the resource</param>
        /// <param name="levelOfStripping">stripping level</param>
        public ZentityAggregatedResource(Guid id, int levelOfStripping)
        {
            if (Guid.Empty == id)
            {
                return;
            }

            ResourceUri           = id;
            this.levelOfStripping = levelOfStripping;
            Resource resource;

            using (ZentityContext context = CoreHelper.CreateZentityContext())
            {
                resource = context.Resources
                           .Where(res => res.Id == ResourceUri)
                           .FirstOrDefault();

                if (resource == null ||
                    !resource.Authorize("Read", context, CoreHelper.GetAuthenticationToken()))
                {
                    throw new ArgumentException(Properties.Resources.ORE_RESOURCE_NOT_FOUND, "id");
                }
            }

            if (string.IsNullOrEmpty(ResourcesType))
            {
                ResourcesType = resource.GetType().ToString();
            }
            RetrieveRelations();
            RetrieveTagsAndCategories();
            RetrieveMetadata(resource);
            RetrieveAggreagates(levelOfStripping);
        }
        /// <summary>
        /// retrieves tags and categories for the resource
        /// </summary>
        private void RetrieveTagsAndCategories()
        {
            using (ZentityContext context = CoreHelper.CreateZentityContext())
            {
                ScholarlyWorkItem resource = context.Resources
                                             .OfType <ScholarlyWorkItem>()
                                             .Where(res => res.Id == ResourceUri)
                                             .FirstOrDefault();

                if (resource == null ||
                    !resource.Authorize("Read", context, CoreHelper.GetAuthenticationToken()))
                {
                    return;
                }

                resource.CategoryNodes.Load();
                List <string> categoryNames = resource.CategoryNodes
                                              .Select(category => category.Title)
                                              .ToList();
                CategoryNames.AddRange(categoryNames);

                resource.Tags.Load();
                List <string> tagNames = resource.Tags
                                         .Select(tag => tag.Name)
                                         .ToList();
                TagNames.AddRange(tagNames);
            }
        }
        /// <summary>
        /// Checks if the member of given type a specified id is present in the given collection.
        /// </summary>
        /// <param name="collectionName">Name of the target collection.</param>
        /// <param name="memberResourceId">Id of the member.</param>
        /// <returns>True if media is present for the given member, else false.</returns>
        /// <exception cref="ArgumentNullException">Throws exception if memberResourceId is null/empty.</exception>
        bool IAtomPubStoreReader.IsMediaPresentForMember(string collectionName, string memberResourceId)
        {
            if (string.IsNullOrEmpty(collectionName))
            {
                throw new ArgumentNullException("collectionName");
            }

            if (string.IsNullOrEmpty(memberResourceId))
            {
                throw new ArgumentNullException("memberResourceId");
            }

            ResourceType collectionType = coreHelper.GetResourceType(collectionName);

            // Prepare a query to get a resource with specified Id and specified type.
            string commandText = string.Format(CultureInfo.InvariantCulture, AtomPubConstants.EsqlToGetFileContents,
                                               collectionType.FullName);

            using (ZentityContext context = CoreHelper.CreateZentityContext())
            {
                ObjectQuery <ScholarlyWork> query = new ObjectQuery <ScholarlyWork>(commandText, context);
                query.Parameters.Add(new ObjectParameter("Id", new Guid(memberResourceId)));

                return(0 < query.Count());
            }
        }
        /// <summary>
        /// retrieves aggregate relations for a resource
        /// </summary>
        /// <param name="levelOfStripping">stripping level</param>
        private void RetrieveAggreagates(int levelOfStripping)
        {
            //No retrievals below stripping level
            if (levelOfStripping <= 0)
            {
                return;
            }
            Debug.Assert(ResourceUri != Guid.Empty);

            using (ZentityContext context = CoreHelper.CreateZentityContext())
            {
                List <Relationship> contains = context.Relationships.Where(
                    relationship =>
                    relationship.Subject.Id == ResourceUri &&
                    relationship.Predicate.Uri == Properties.Resources.ORE_CONTAINS_PREDICATE
                    ).ToList();
                foreach (Relationship relation in contains)
                {
                    relation.ObjectReference.Load();
                    ZentityAggregatedResource resource = new ZentityAggregatedResource(relation.Object.Id, --levelOfStripping);
                    AggreagtedResources.Add(resource);
                    Type objectType = context.Resources.Where(res => res.Id == relation.Object.Id).First().GetType();
                    AggregateTypes.Add(objectType);
                }
            }
        }
Exemple #8
0
        /// <summary>
        /// Gets the predicate with the given uri.
        /// </summary>
        /// <param name="predicateUri">Predicate uri</param>
        /// <param name="context">Zentity context</param>
        /// <returns>Predicate with the given uri</returns>
        internal static Predicate GetPredicate(string predicateUri, ZentityContext context)
        {
            Predicate createPredicate = context.Predicates.Where <Zentity.Core.Predicate>(
                pr => pr.Uri.Equals(predicateUri, StringComparison.OrdinalIgnoreCase))
                                        .FirstOrDefault();

            return(createPredicate);
        }
Exemple #9
0
 /// <summary>
 /// Creates a new user and adds it to authentication and authorization stores.
 /// </summary>
 /// <param name="user">User object with all information.</param>
 /// <param name="token">Token of user who is allowed to create a user.</param>
 /// <returns>True if user is created successfully, else false.</returns>
 public static bool CreateUser(ZentityUser user, AuthenticatedToken token)
 {
     ////The CreateUser overload called below handles parameter validation
     using (ZentityContext context = new ZentityContext())
     {
         return(CreateUser(user, token, context));
     }
 }
 /// <summary>
 /// Adds the file resource.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="resource">The resource.</param>
 /// <returns>The added <see cref="Core.File"/> type.</returns>
 private static Core.File AddFileResource(ZentityContext context, ScholarlyWork resource)
 {
     Core.File mediaResource = new Core.File();
     context.AddToResources(mediaResource);
     context.SaveChanges();
     resource.Files.Add(mediaResource);
     return(mediaResource);
 }
Exemple #11
0
        /// <summary>
        /// Retrieves group having the given name
        /// </summary>
        /// <param name="groupName">Group name to retieve</param>
        /// <param name="context">Zentity context</param>
        /// <returns>Group name</returns>
        internal static Group GetGroup(string groupName, ZentityContext context)
        {
            Group group = context.Resources.OfType <Group>()
                          .Where(iden => iden.GroupName.Equals(groupName, StringComparison.OrdinalIgnoreCase))
                          .FirstOrDefault();

            return(group);
        }
Exemple #12
0
        public static ZentityContext CreateContext()
        {
            ZentityContext context = new ZentityContext();

            context.CommandTimeout = Utility.ConnectionTimeout;
            LoadMetadata(context);
            return(context);
        }
Exemple #13
0
        //internal static Core.ResourceTypeInfo GetResourceType(Core.Resource resource)
        //{
        //    if (null == resource)
        //    {
        //        return null;
        //    }

        //    Core.ResourceTypeInfo resourceType = null;
        //    using (Core.ZentityContext context = CoreHelper.GetZentityContext())
        //    {
        //      resourceType = CoreHelper.GetResourceType(context, resource);
        //    }

        //    return resourceType;
        //}

        #endregion

        #region Private Member functions

        /// <summary>
        /// Filters the query.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns><see cref="IQueryable"/> of <see cref="Resource"/> types.</returns>
        private IQueryable <Resource> FilterQuery(ZentityContext context)
        {
            return(context.Resources.
                   Where(resource => !(resource is Resource &&
                                       (((Resource)resource) is Contact ||
                                        ((Resource)resource) is Group ||
                                        ((Resource)resource) is Identity))));
        }
Exemple #14
0
        /// <summary>
        /// Gets the identity with the given name
        /// </summary>
        /// <param name="identityName">Identity name</param>
        /// <param name="context">Zentity context</param>
        /// <returns>Identity with the given name</returns>
        internal static Identity GetIdentity(string identityName, ZentityContext context)
        {
            Identity user = context.Resources.OfType <Identity>()
                            .Where(iden => iden.IdentityName.Equals(identityName, StringComparison.OrdinalIgnoreCase))
                            .FirstOrDefault();

            return(user);
        }
 /// <summary>
 /// Gets the specified resource.
 /// </summary>
 /// <param name="collectionName">The name of the resource type.</param>
 /// <param name="memberResourceId">The Guid of the resource to return.</param>
 /// <returns>A SyndicationItem for the specified resource.</returns>
 /// <exception cref="ArgumentNullException">Throws exception if collectionName is null/empty.</exception>
 SyndicationItem IAtomPubStoreReader.GetMember(string collectionName, string memberResourceId)
 {
     using (ZentityContext context = CoreHelper.CreateZentityContext())
     {
         ScholarlyWork resource = (ScholarlyWork)AtomPubHelper.GetMember(context, collectionName, memberResourceId, "Read");
         return(ZentityAtomPubStoreReader.GenerateSyndicationItem(this.BaseUri, resource));
     }
 }
        /// <summary>
        /// Adds the child resources.
        /// </summary>
        /// <param name="extractionPath">The extraction path.</param>
        /// <param name="document">The document.</param>
        /// <param name="resource">The resource.</param>
        /// <param name="zentityContext">The zentity context.</param>
        private static void AddChildResources(
            string extractionPath,
            MetsDocument document,
            ScholarlyWork resource,
            ZentityContext zentityContext)
        {
            resource.Container = new ScholarlyWorkContainer();
            ScholarlyWorkContainer childContainer = null;

            string[] fileNames = Directory.GetFiles(extractionPath)
                                 .Select(path => GetFileName(path))
                                 .Where(name => SwordConstants.MetsDocumentName != name)
                                 .ToArray();

            if (0 < fileNames.Length)
            {
                childContainer = new ScholarlyWorkContainer();
                resource.Container.ContainedWorks.Add(childContainer);
            }

            // Loop though all files which are extracted.
            foreach (string fileName in fileNames)
            {
                // Get the extension
                int    dotIndex      = fileName.LastIndexOf('.');
                string fileExtension = (0 < dotIndex) ? fileName.Substring(dotIndex + 1) : string.Empty;

                #region Upload Zip File Contents

                // Get Metadata for the specified fileName
                MetadataSection dataSection = document.Files[fileName];

                // Create resource against each type as specified in the METS document.
                ScholarlyWork individualResource = CreateResouceUsingMetsMetadata(dataSection);

                UpdateResourceProeprties(zentityContext, individualResource, dataSection);

                // Create Media and Upload file contents.
                Core.File individualMediaResource = AddFileResource(zentityContext,
                                                                    individualResource,
                                                                    extractionPath + "\\" + fileName);
                individualMediaResource.MimeType      = AtomPubHelper.GetMimeTypeFromFileExtension(fileExtension);
                individualMediaResource.FileExtension = fileExtension;

                // Save file name in notes for future references.
                individualMediaResource.Description = fileName;

                // Associate with the main resource.
                childContainer.ContainedWorks.Add(individualResource);

                #endregion

                AuthenticatedToken authenticatedToken = CoreHelper.GetAuthenticationToken();

                individualResource.GrantDefaultPermissions(zentityContext, authenticatedToken);
                individualMediaResource.GrantDefaultPermissions(zentityContext, authenticatedToken);
            }
        }
Exemple #17
0
        /// <summary>
        /// Updates the Resource.File of the specified resource.
        /// </summary>
        /// <param name="collectionName">The type of the resource.</param>
        /// <param name="memberResourceId">The resource whose File needs to be updated.</param>
        /// <param name="mimeType">The MIME type of media.</param>
        /// <param name="media">The new File contents.</param>
        /// <returns>A SyndicationItem that describes the updated resource.</returns>
        /// <exception cref="ArgumentNullException">Throws exception if collectionName is null/empty
        /// or media is null.</exception>
        /// <exception cref="ArgumentException">Throws exception if requested memberResourceId is not a unique identifier.</exception>
        SyndicationItem IAtomPubStoreWriter.UpdateMedia(string collectionName, string memberResourceId, string mimeType, byte[] media)
        {
            if (string.IsNullOrEmpty(collectionName))
            {
                throw new ArgumentNullException("collectionName");
            }

            if (null == media)
            {
                throw new ArgumentNullException("media");
            }

            if (string.IsNullOrEmpty(memberResourceId))
            {
                throw new ArgumentNullException("memberResourceId");
            }

            if (!AtomPubHelper.IsValidGuid(memberResourceId))
            {
                throw new ArgumentException(Resources.ATOMPUB_INVALID_RESOURCE_ID, "memberResourceId");
            }

            using (ZentityContext context = CoreHelper.CreateZentityContext())
            {
                Type collectionType = CoreHelper.GetSystemResourceType(collectionName);
                // Prepare a query to get a resource with specified Id and specified type.
                string commandText = string.Format(CultureInfo.InvariantCulture, AtomPubConstants.EsqlToGetFileContents,
                                                   collectionType.FullName);

                ObjectQuery <Core.File> query = new ObjectQuery <Core.File>(commandText, context);
                query.Parameters.Add(new ObjectParameter("Id", new Guid(memberResourceId)));
                Core.File mediaResource = query.FirstOrDefault();

                if (null == mediaResource)
                {
                    throw new ResourceNotFoundException(Resources.ATOMPUB_RESOURCE_NOT_FOUND);
                }

                if (!mediaResource.Authorize("Update", context, CoreHelper.GetAuthenticationToken()))
                {
                    throw new UnauthorizedException(Resources.ATOMPUB_UNAUTHORIZED);
                }

                mediaResource.Resources.Load();
                ScholarlyWork resource = (ScholarlyWork)mediaResource.Resources.First();
                resource.DateModified       = DateTime.Now;
                mediaResource.MimeType      = mimeType;
                mediaResource.FileExtension = AtomPubHelper.GetFileExtension(mimeType);

                MemoryStream mediaStream = ZentityAtomPubStoreWriter.GetMediaStream(media);
                context.UploadFileContent(mediaResource, mediaStream);

                // Bug Fix : 180811 - Save Changes once mime type and contents are set.
                context.SaveChanges();

                return(ZentityAtomPubStoreReader.GenerateSyndicationItem(this.BaseUri, resource));
            }
        }
Exemple #18
0
        /// <summary>
        /// Validates the parameters.
        /// </summary>
        /// <param name="context">Zentity context</param>
        /// <param name="userToken">Authenticated token</param>
        private static void ValidateParameters(ZentityContext context, AuthenticatedToken userToken)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            ValidateToken(userToken);
        }
Exemple #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchTokens"/> class.
 /// </summary>
 /// <param name="context"><see cref="ZentityContext" /> instance to fetch data with.</param>
 public SearchTokens(ZentityContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     this.context        = context;
     SqlConnectionString = context.StoreConnectionString;
 }
 /// <summary>
 /// Adds the file resource.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="resource">The resource.</param>
 /// <param name="mediaFilePath">The media file path.</param>
 /// <returns>The added <see cref="Core.File"/> type.</returns>
 private static Core.File AddFileResource(
     ZentityContext context,
     ScholarlyWork resource,
     string mediaFilePath)
 {
     Core.File mediaResource = AddFileResource(context, resource);
     context.UploadFileContent(mediaResource, mediaFilePath);
     return(mediaResource);
 }
Exemple #21
0
        /// <summary>
        /// Gets the administrator identities.
        /// </summary>
        /// <param name="context">Zentity context</param>
        /// <returns>List of identities</returns>
        internal static IEnumerable <Identity> GetAdministratorIdentities(ZentityContext context)
        {
            Group adminGroup = (context.Resources.OfType <Group>()
                                .Where(grp => grp.GroupName.Equals(AdminGroupName, StringComparison.OrdinalIgnoreCase))
                                as ObjectQuery <Group>)
                               .Include("Identities")
                               .FirstOrDefault();

            return(adminGroup.Identities);
        }
Exemple #22
0
 /// <summary>
 /// Returns all Group objects
 /// </summary>
 /// <param name="context">ZentityContext object</param>
 /// <returns>Query which will return all groups when it is enumerated</returns>
 public static ObjectQuery <Group> GetAllGroups(ZentityContext context)
 {
     #region Parameter Validation
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     #endregion
     return(context.Resources.OfType <Group>());
 }
 /// <summary>
 /// Adds the file resource.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="resource">The resource.</param>
 /// <param name="mediaStream">The media stream.</param>
 /// <returns>The added <see cref="Core.File"/> type.</returns>
 private static Core.File AddFileResource(
     ZentityContext context,
     ScholarlyWork resource,
     Stream mediaStream)
 {
     Core.File mediaResource = AddFileResource(context, resource);
     mediaStream.Position = 0;
     context.UploadFileContent(mediaResource, mediaStream);
     return(mediaResource);
 }
Exemple #24
0
        /// <summary>
        /// Processes the request sent to the specified Uri.
        /// This method assumes that the request is already validated.
        /// </summary>
        /// <param name="context">An instance of HttpContext containing the request details.</param>
        /// <param name="statusCode">The HttpStatusCode indicating status of the request.</param>
        /// <returns>
        /// A string containing the response to the request.
        /// </returns>
        public string ProcessRequest(HttpContext context, out HttpStatusCode statusCode)
        {
            string response = string.Empty;
            SyndicationRequestType requestType = SyndicationHelper.GetSyndicationRequestType(context, this.baseUri);

            if (SyndicationRequestType.Help == requestType)
            {
                statusCode = HttpStatusCode.OK;
                response   = Properties.Resources.Help;
            }
            else
            {
                string searchQuery = HttpUtility.UrlDecode(context.Request.QueryString.ToString());
                int    pageSize    = int.Parse(ConfigurationManager.AppSettings["DefaultPageSize"], CultureInfo.InvariantCulture);
                int    maxPageSize = int.Parse(ConfigurationManager.AppSettings["MaxPageSize"], CultureInfo.InvariantCulture);

                if (SyndicationRequestType.DefaultSearchWithPageNo == requestType ||
                    SyndicationRequestType.RSSSearchWithPageNo == requestType ||
                    SyndicationRequestType.ATOMSearchWithPageNo == requestType)
                {
                    pageSize = int.Parse(SyndicationHelper.GetValueOfParameterFromUri(context, this.baseUri,
                                                                                      requestType, SyndicationParameterType.PageSize), CultureInfo.InvariantCulture);
                    pageSize = (pageSize > maxPageSize) ? maxPageSize : pageSize;
                }

                AuthenticatedToken token = (AuthenticatedToken)context.Items["AuthenticatedToken"];
                List <Resource>    resources;
                try
                {
                    SearchEngine searchEngin =
                        new SearchEngine(pageSize, true, token);
                    int            totalRecords;
                    ZentityContext zentityContext = CoreHelper.CreateZentityContext();
                    SortProperty   sortProperty   =
                        new SortProperty("dateModified", SortDirection.Descending);

                    resources = searchEngin.SearchResources(searchQuery,
                                                            zentityContext, sortProperty, 0, out totalRecords).ToList();
                    ;
                }
                catch (SearchException exception)
                {
                    statusCode = HttpStatusCode.BadRequest;
                    response   = exception.Message;
                    return(response);
                }
                SyndicationFeed feed = SyndicationHelper.CreateSyndicationFeed(resources, searchQuery, context.Request.Url);

                response = SyndicationHelper.GetResponseDocument(feed, requestType);

                statusCode = HttpStatusCode.OK;
            }
            return(response);
        }
Exemple #25
0
        /// <summary>
        /// Determines whether the specified identity name is admin.
        /// </summary>
        /// <param name="identityName">Name of the identity.</param>
        /// <param name="context">The context.</param>
        /// <returns>
        ///     <c>true</c> if the specified identity name is admin; otherwise, <c>false</c>.
        /// </returns>
        internal static bool IsAdmin(string identityName, ZentityContext context)
        {
            Identity currentUser = GetIdentity(identityName, context);

            if (currentUser == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentUICulture, ConstantStrings.IdentityDoesNotExist, identityName));
            }

            return(IsAdmin(currentUser));
        }
Exemple #26
0
        /// <summary>
        /// Creates a new group.
        /// </summary>
        /// <param name="group">Group object with all information.</param>
        /// <param name="token">Token of user who is allowed to create a group.</param>
        /// <param name="connectionString">Connection string of authorization store.</param>
        /// <returns>True if group is created successfully, else false.</returns>
        public static bool CreateGroup(Group group, AuthenticatedToken token, string connectionString)
        {
            #region Parameter Validation
            ValidateStrings("connectionString", connectionString);
            #endregion

            using (ZentityContext context = new ZentityContext(connectionString))
            {
                return(CreateGroup(group, token, context));
            }
        }
Exemple #27
0
        /// <summary>
        /// Validates the parameters.
        /// </summary>
        /// <param name="context">Zentity context</param>
        /// <param name="authorizingPredicateUris">Authorizing predicate uri</param>
        private static void ValidateParameters(ZentityContext context, IQueryable <string> authorizingPredicateUris)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (authorizingPredicateUris == null)
            {
                throw new ArgumentNullException("authorizingPredicateUris");
            }
        }
Exemple #28
0
        /// <summary>
        /// Ges the identity of the entity accessessing zentity core.
        /// </summary>
        /// <param name="context">Zentity context</param>
        /// <param name="token">Authenticated tokend </param>
        /// <returns>Identity of the entity accessessing zentity core</returns>
        private static Identity GetIdentity(ZentityContext context, AuthenticatedToken token)
        {
            Identity identity = context.Resources.OfType <Identity>()
                                .Where(s => s.IdentityName == token.IdentityName).First();

            if (identity == null)
            {
                throw new AuthenticationException(Resources.InvalidToken);
            }

            return(identity);
        }
Exemple #29
0
        /// <summary>
        /// Validates the parameters.
        /// </summary>
        /// <param name="authorizingPredicateUri">Authorizing predicate uri</param>
        /// <param name="context">Zentity context</param>
        private static void ValidateParameters(string authorizingPredicateUri, ZentityContext context)
        {
            if (string.IsNullOrEmpty(authorizingPredicateUri))
            {
                throw new ArgumentNullException("authorizingPredicateUri");
            }

            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
        }
Exemple #30
0
        /// <summary>
        /// This method returns all authorized resources for the current identity for the given predicate.
        /// </summary>
        /// <param name="context">ZentityContext object</param>
        /// <param name="authorizingPredicateUri">Uri for the permission predicate</param>
        /// <returns>Query which, when enumerated, will give all resources for which the identity has given permission.</returns>
        public IQueryable <Resource> GetAuthorizedResources(ZentityContext context, string authorizingPredicateUri)
        {
            #region Parameter Validation
            ValidateParameters(authorizingPredicateUri, context);
            #endregion

            IQueryable <Resource> identityFilteredResources =
                context.Relationships.Where(tuple => tuple.Predicate.Uri.Equals(authorizingPredicateUri, StringComparison.OrdinalIgnoreCase) &&
                                            tuple.Subject.Id == this.Id).Select(tuple => tuple.Object);

            return(identityFilteredResources);
        }
Exemple #31
0
        public void deleteALL(ZentityContext context)
        {
            ArrayList l = new ArrayList();
            foreach (ImageResource2 img in context.Resources.OfType<ImageResource2>())
            {
                foreach (Zentity.Core.File f in img.Files)
                {
                    context.DeleteResourceHasFile(img.Id, f.Id);
                    context.DeleteResourceHasFile(f.Id, img.Id);

                    context.DeleteResource(f.Id);
                }
                l.Add(img.Id);
            }
            foreach (Guid g in l)
                context.DeleteResource(g);
        }
Exemple #32
0
        public void createDM()
        {
            ZentityContext context = new ZentityContext(connectionString);

            // Create a new module.
            DataModelModule module = new DataModelModule { NameSpace = "Zentity.Flickr" };
            // Sent to line   36         context.DataModel.Modules.Add(module);

            // Create the ScholarlyWork type.
            ResourceType resourceTypeResource = context.DataModel.Modules["Zentity.Core"].ResourceTypes["Resource"];
            ResourceType resourceTypeImage = new ResourceType { Name = "ImageResource", BaseType = resourceTypeResource };
            module.ResourceTypes.Add(resourceTypeImage);

            // Create some Scalar Properties.
            ScalarProperty TagFamilia = new ScalarProperty { Name = "TagFamilia", DataType = DataTypes.Boolean };
            resourceTypeImage.ScalarProperties.Add(TagFamilia);

            // Create some Scalar Properties.
            ScalarProperty TagRumba = new ScalarProperty { Name = "TagRumba", DataType = DataTypes.Boolean };
            resourceTypeImage.ScalarProperties.Add(TagRumba);

            // Synchronize to alter the database schema.
            context.DataModel.Modules.Add(module);
            context.DataModel.Synchronize();

            // Generate Extensions Assembly.
            using (FileStream fout = new FileStream(@"C:\Zentity\Zentity.Flickr.dll", FileMode.Create, FileAccess.Write))
            {
                byte[] rawAssembly = context.DataModel.GenerateExtensionsAssembly(
                    "Zentity.Flickr", false, null, new string[] { "Zentity.Flickr" }, null);
                fout.Write(rawAssembly, 0, rawAssembly.Length);
            }

            // Generate Entity Framework artifacts.
            EFArtifactGenerationResults results = context.DataModel.GenerateEFArtifacts("Zentity.Flickr");
            results.Csdls.Where(tuple => tuple.Key == "Zentity.Core").First().Value.Save(@"C:\Zentity\Zentity.Flickr.ExtendedCore.csdl");
            results.Csdls.Where(tuple => tuple.Key == "Zentity.Flickr").First().Value.Save(@"C:\Zentity\Zentity.Flickr.csdl");
            results.Msl.Save(@"C:\Zentity\Zentity.Flickr.Consolidated.msl");
            results.Ssdl.Save(@"C:\Zentity\Zentity.Flickr.Consolidated.ssdl");
        }
Exemple #33
0
        public void CreateDM()
        {
            ZentityContext context = new ZentityContext(connectionString);
             	 	   //Create a new module.
             	    DataModelModule module = new DataModelModule { NameSpace = "Zentity.Corel52" };
             	   // Create the Resources type.
             	    ResourceType resourceTypeResource = context.DataModel.Modules["Zentity.Core"].ResourceTypes["Resource"];
             	    ResourceType Corel5Image2 = new ResourceType { Name = "Corel5Image2", BaseType = resourceTypeResource };
             	    module.ResourceTypes.Add(Corel5Image2);
             	    // Create some Scalar Properties.
             	    ScalarProperty Main_Textual_Category = new ScalarProperty { Name = "Main_Textual_Category", DataType =DataTypes.String };
             	    Corel5Image2.ScalarProperties.Add(Main_Textual_Category);
             	    ScalarProperty Main_Visual_Category = new ScalarProperty { Name = "Main_Visual_Category", DataType =DataTypes.String };
             	    Corel5Image2.ScalarProperties.Add(Main_Visual_Category);
             	    ScalarProperty ImageID = new ScalarProperty { Name = "ImageID", DataType =DataTypes.String };
             	    Corel5Image2.ScalarProperties.Add(ImageID);
             	    ScalarProperty LTT_hills_dunes_road_canyon_antelope_caribou_palace = new ScalarProperty { Name = "LTT_hills_dunes_road_canyon_antelope_caribou_palace", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_hills_dunes_road_canyon_antelope_caribou_palace);
             	    ScalarProperty LTT_sunset_horizon_desert_valley_landscape_sunrise_palm = new ScalarProperty { Name = "LTT_sunset_horizon_desert_valley_landscape_sunrise_palm", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_sunset_horizon_desert_valley_landscape_sunrise_palm);
             	    ScalarProperty LTT_water_reflection_shore_zebra_park_restaurant_herd = new ScalarProperty { Name = "LTT_water_reflection_shore_zebra_park_restaurant_herd", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_water_reflection_shore_zebra_park_restaurant_herd);
             	    ScalarProperty LTT_plane_jet_runway_smoke_f__16_prop_zebra = new ScalarProperty { Name = "LTT_plane_jet_runway_smoke_f__16_prop_zebra", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_plane_jet_runway_smoke_f__16_prop_zebra);
             	    ScalarProperty LTT_harbor_tower_water_sky_ships_windmills_town = new ScalarProperty { Name = "LTT_harbor_tower_water_sky_ships_windmills_town", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_harbor_tower_water_sky_ships_windmills_town);
             	    ScalarProperty LTT_window_door_castle_courtyard_farms_tables_palace = new ScalarProperty { Name = "LTT_window_door_castle_courtyard_farms_tables_palace", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_window_door_castle_courtyard_farms_tables_palace);
             	    ScalarProperty LTT_field_tulip_bulls_elk_row_farms_vineyard = new ScalarProperty { Name = "LTT_field_tulip_bulls_elk_row_farms_vineyard", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_field_tulip_bulls_elk_row_farms_vineyard);
             	    ScalarProperty LTT_coast_waves_water_town_lighthouse_park_fog = new ScalarProperty { Name = "LTT_coast_waves_water_town_lighthouse_park_fog", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_coast_waves_water_town_lighthouse_park_fog);
             	    ScalarProperty LTT_swimmers_people_athlete_pool_interior_wings_chairs = new ScalarProperty { Name = "LTT_swimmers_people_athlete_pool_interior_wings_chairs", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_swimmers_people_athlete_pool_interior_wings_chairs);
             	    ScalarProperty LTT_cat_tiger_forest_bengal_head_ground_lynx = new ScalarProperty { Name = "LTT_cat_tiger_forest_bengal_head_ground_lynx", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_cat_tiger_forest_bengal_head_ground_lynx);
             	    ScalarProperty LTT_bear_polar_tundra_black_grizzly_cubs_ice = new ScalarProperty { Name = "LTT_bear_polar_tundra_black_grizzly_cubs_ice", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_bear_polar_tundra_black_grizzly_cubs_ice);
             	    ScalarProperty LTT_sun_sea_waves_land_bay_lake_sunrise = new ScalarProperty { Name = "LTT_sun_sea_waves_land_bay_lake_sunrise", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_sun_sea_waves_land_bay_lake_sunrise);
             	    ScalarProperty LTT_tree_forest_park_frost_elk_palace_deer = new ScalarProperty { Name = "LTT_tree_forest_park_frost_elk_palace_deer", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_tree_forest_park_frost_elk_palace_deer);
             	    ScalarProperty LTT_island_village_water_face_formation_farms_ships = new ScalarProperty { Name = "LTT_island_village_water_face_formation_farms_ships", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_island_village_water_face_formation_farms_ships);
             	    ScalarProperty LTT_temple_pillar_roofs_buddha_buddhist_mosque_road = new ScalarProperty { Name = "LTT_temple_pillar_roofs_buddha_buddhist_mosque_road", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_temple_pillar_roofs_buddha_buddhist_mosque_road);
             	    ScalarProperty LTT_house_roofs_hut_village_fence_lawn_town = new ScalarProperty { Name = "LTT_house_roofs_hut_village_fence_lawn_town", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_house_roofs_hut_village_fence_lawn_town);
             	    ScalarProperty LTT_beach_palm_sand_oahu_kauai_sunset_hawaii = new ScalarProperty { Name = "LTT_beach_palm_sand_oahu_kauai_sunset_hawaii", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_beach_palm_sand_oahu_kauai_sunset_hawaii);
             	    ScalarProperty LTT_snow_fox_polar_coyote_head_arctic_deer = new ScalarProperty { Name = "LTT_snow_fox_polar_coyote_head_arctic_deer", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_snow_fox_polar_coyote_head_arctic_deer);
             	    ScalarProperty LTT_river_water_fox_elk_autumn_coyote_antlers = new ScalarProperty { Name = "LTT_river_water_fox_elk_autumn_coyote_antlers", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_river_water_fox_elk_autumn_coyote_antlers);
             	    ScalarProperty LTT_pool_hotel_town_water_swimmers_maui_people = new ScalarProperty { Name = "LTT_pool_hotel_town_water_swimmers_maui_people", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_pool_hotel_town_water_swimmers_maui_people);
             	    ScalarProperty LTT_bridge_arch_steel_stone_train_courtyard_architecture = new ScalarProperty { Name = "LTT_bridge_arch_steel_stone_train_courtyard_architecture", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_bridge_arch_steel_stone_train_courtyard_architecture);
             	    ScalarProperty LTT_sand_valley_desert_dunes_pyramid_canyon_sailboats = new ScalarProperty { Name = "LTT_sand_valley_desert_dunes_pyramid_canyon_sailboats", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_sand_valley_desert_dunes_pyramid_canyon_sailboats);
             	    ScalarProperty LTT_train_railroad_locomotive_smoke_tracks_close__up_bridge = new ScalarProperty { Name = "LTT_train_railroad_locomotive_smoke_tracks_close__up_bridge", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_train_railroad_locomotive_smoke_tracks_close__up_bridge);
             	    ScalarProperty LTT_clouds_palace_ruins_tower_park_buddhist_pyramid = new ScalarProperty { Name = "LTT_clouds_palace_ruins_tower_park_buddhist_pyramid", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_clouds_palace_ruins_tower_park_buddhist_pyramid);
             	    ScalarProperty LTT_ice_frost_frozen_crystals_fruit_glass_stick = new ScalarProperty { Name = "LTT_ice_frost_frozen_crystals_fruit_glass_stick", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_ice_frost_frozen_crystals_fruit_glass_stick);
             	    ScalarProperty LTT_sky_flight_roofs_prop_castle_church_park = new ScalarProperty { Name = "LTT_sky_flight_roofs_prop_castle_church_park", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_sky_flight_roofs_prop_castle_church_park);
             	    ScalarProperty LTT_mountain_valley_desert_park_ruins_road_goat = new ScalarProperty { Name = "LTT_mountain_valley_desert_park_ruins_road_goat", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_mountain_valley_desert_park_ruins_road_goat);
             	    ScalarProperty LTT_city_skyline_night_light_landscape_tower_church = new ScalarProperty { Name = "LTT_city_skyline_night_light_landscape_tower_church", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_city_skyline_night_light_landscape_tower_church);
             	    ScalarProperty LTT_rocks_fox_canyon_valley_rodent_tortoise_giant = new ScalarProperty { Name = "LTT_rocks_fox_canyon_valley_rodent_tortoise_giant", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_rocks_fox_canyon_valley_rodent_tortoise_giant);
             	    ScalarProperty LTT_stone_ruins_sculpture_pyramid_pillar_road_relief = new ScalarProperty { Name = "LTT_stone_ruins_sculpture_pyramid_pillar_road_relief", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_stone_ruins_sculpture_pyramid_pillar_road_relief);
             	    ScalarProperty LTT_water_grizzly_tusks_horizon_ground_bear_canal = new ScalarProperty { Name = "LTT_water_grizzly_tusks_horizon_ground_bear_canal", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_water_grizzly_tusks_horizon_ground_bear_canal);
             	    ScalarProperty LTT_boats_water_skyline_market_maui_restaurant_paintings = new ScalarProperty { Name = "LTT_boats_water_skyline_market_maui_restaurant_paintings", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_boats_water_skyline_market_maui_restaurant_paintings);
             	    ScalarProperty LTT_cars_tracks_turn_prototype_formula_straightaway_close__up = new ScalarProperty { Name = "LTT_cars_tracks_turn_prototype_formula_straightaway_close__up", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_cars_tracks_turn_prototype_formula_straightaway_close__up);
             	    ScalarProperty LTT_scotland_town_castle_village_cottage_church_mountain = new ScalarProperty { Name = "LTT_scotland_town_castle_village_cottage_church_mountain", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_scotland_town_castle_village_cottage_church_mountain);
             	    ScalarProperty LTT_grass_zebra_fox_herd_ground_antlers_caribou = new ScalarProperty { Name = "LTT_grass_zebra_fox_herd_ground_antlers_caribou", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_grass_zebra_fox_herd_ground_antlers_caribou);
             	    ScalarProperty LTT_wall_formula_church_castle_sign_writing_facade = new ScalarProperty { Name = "LTT_wall_formula_church_castle_sign_writing_facade", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_wall_formula_church_castle_sign_writing_facade);
             	    ScalarProperty LTT_people_woman_indian_hats_costume_girl_monks = new ScalarProperty { Name = "LTT_people_woman_indian_hats_costume_girl_monks", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_people_woman_indian_hats_costume_girl_monks);
             	    ScalarProperty LTT_ocean_coral_reefs_fish_sea_anemone_fan = new ScalarProperty { Name = "LTT_ocean_coral_reefs_fish_sea_anemone_fan", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_ocean_coral_reefs_fish_sea_anemone_fan);
             	    ScalarProperty LTT_buildings_skyline_village_hotel_flag_roofs_light = new ScalarProperty { Name = "LTT_buildings_skyline_village_hotel_flag_roofs_light", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_buildings_skyline_village_hotel_flag_roofs_light);
             	    ScalarProperty LTT_shops_market_display_food_sign_restaurant_writing = new ScalarProperty { Name = "LTT_shops_market_display_food_sign_restaurant_writing", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_shops_market_display_food_sign_restaurant_writing);
             	    ScalarProperty LTT_branch_tree_sign_shrubs_leopard_elephant_blossoms = new ScalarProperty { Name = "LTT_branch_tree_sign_shrubs_leopard_elephant_blossoms", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_branch_tree_sign_shrubs_leopard_elephant_blossoms);
             	    ScalarProperty LTT_plants_leaf_close__up_stems_head_palm_lily = new ScalarProperty { Name = "LTT_plants_leaf_close__up_stems_head_palm_lily", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_plants_leaf_close__up_stems_head_palm_lily);
             	    ScalarProperty LTT_statue_sculpture_palace_sphinx_figures_buddha_castle = new ScalarProperty { Name = "LTT_statue_sculpture_palace_sphinx_figures_buddha_castle", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_statue_sculpture_palace_sphinx_figures_buddha_castle);
             	    ScalarProperty LTT_water_cliff_white__tailed_deer_fountain_people_marine = new ScalarProperty { Name = "LTT_water_cliff_white__tailed_deer_fountain_people_marine", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_water_cliff_white__tailed_deer_fountain_people_marine);
             	    ScalarProperty LTT_garden_lawn_landscape_flowers_path_bench_palace = new ScalarProperty { Name = "LTT_garden_lawn_landscape_flowers_path_bench_palace", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_garden_lawn_landscape_flowers_path_bench_palace);
             	    ScalarProperty LTT_horses_foals_mare_fence_field_town_guard = new ScalarProperty { Name = "LTT_horses_foals_mare_fence_field_town_guard", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_horses_foals_mare_fence_field_town_guard);
             	    ScalarProperty LTT_people_man_pillar_ceremony_courtyard_umbrella_kauai = new ScalarProperty { Name = "LTT_people_man_pillar_ceremony_courtyard_umbrella_kauai", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_people_man_pillar_ceremony_courtyard_umbrella_kauai);
             	    ScalarProperty LTT_street_town_cars_skyline_guard_sign_buildings = new ScalarProperty { Name = "LTT_street_town_cars_skyline_guard_sign_buildings", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_street_town_cars_skyline_guard_sign_buildings);
             	    ScalarProperty LTT_birds_nest_flight_booby_fly_albatross_wood = new ScalarProperty { Name = "LTT_birds_nest_flight_booby_fly_albatross_wood", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_birds_nest_flight_booby_fly_albatross_wood);
             	    ScalarProperty LTT_flowers_petals_leaf_tulip_stems_poppies_blooms = new ScalarProperty { Name = "LTT_flowers_petals_leaf_tulip_stems_poppies_blooms", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTT_flowers_petals_leaf_tulip_stems_poppies_blooms);
             	    ScalarProperty LTV_water_sky_people_mountain_beach_waves_rocks = new ScalarProperty { Name = "LTV_water_sky_people_mountain_beach_waves_rocks", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_water_sky_people_mountain_beach_waves_rocks);
             	    ScalarProperty LTV_tree_grass_field_horses_foals_mare_train = new ScalarProperty { Name = "LTV_tree_grass_field_horses_foals_mare_train", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_tree_grass_field_horses_foals_mare_train);
             	    ScalarProperty LTV_snow_cars_tracks_wall_tree_formula_frost = new ScalarProperty { Name = "LTV_snow_cars_tracks_wall_tree_formula_frost", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_snow_cars_tracks_wall_tree_formula_frost);
             	    ScalarProperty LTV_water_snow_polar_bear_stone_tracks_cars = new ScalarProperty { Name = "LTV_water_snow_polar_bear_stone_tracks_cars", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_water_snow_polar_bear_stone_tracks_cars);
             	    ScalarProperty LTV_ruins_stone_tree_water_snow_scotland_mountain = new ScalarProperty { Name = "LTV_ruins_stone_tree_water_snow_scotland_mountain", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_ruins_stone_tree_water_snow_scotland_mountain);
             	    ScalarProperty LTV_tusks_ground_water_sand_valley_sky_dunes = new ScalarProperty { Name = "LTV_tusks_ground_water_sand_valley_sky_dunes", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_tusks_ground_water_sand_valley_sky_dunes);
             	    ScalarProperty LTV_people_buildings_sky_sunset_tree_night_city = new ScalarProperty { Name = "LTV_people_buildings_sky_sunset_tree_night_city", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_people_buildings_sky_sunset_tree_night_city);
             	    ScalarProperty LTV_garden_ruins_tree_people_stone_sky_wall = new ScalarProperty { Name = "LTV_garden_ruins_tree_people_stone_sky_wall", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_garden_ruins_tree_people_stone_sky_wall);
             	    ScalarProperty LTV_sky_flowers_mountain_people_clouds_water_leaf = new ScalarProperty { Name = "LTV_sky_flowers_mountain_people_clouds_water_leaf", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_flowers_mountain_people_clouds_water_leaf);
             	    ScalarProperty LTV_sky_jet_plane_train_railroad_tree_pool = new ScalarProperty { Name = "LTV_sky_jet_plane_train_railroad_tree_pool", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_jet_plane_train_railroad_tree_pool);
             	    ScalarProperty LTV_water_grass_bear_polar_mist_dunes_cubs = new ScalarProperty { Name = "LTV_water_grass_bear_polar_mist_dunes_cubs", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_water_grass_bear_polar_mist_dunes_cubs);
             	    ScalarProperty LTV_sky_jet_plane_mountain_sand_snow_valley = new ScalarProperty { Name = "LTV_sky_jet_plane_mountain_sand_snow_valley", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_jet_plane_mountain_sand_snow_valley);
             	    ScalarProperty LTV_sky_jet_plane_water_tree_bridge_pool = new ScalarProperty { Name = "LTV_sky_jet_plane_water_tree_bridge_pool", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_jet_plane_water_tree_bridge_pool);
             	    ScalarProperty LTV_sky_plane_jet_eagle_flight_mountain_birds = new ScalarProperty { Name = "LTV_sky_plane_jet_eagle_flight_mountain_birds", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_plane_jet_eagle_flight_mountain_birds);
             	    ScalarProperty LTV_sky_plane_jet_tree_mountain_bridge_castle = new ScalarProperty { Name = "LTV_sky_plane_jet_tree_mountain_bridge_castle", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_plane_jet_tree_mountain_bridge_castle);
             	    ScalarProperty LTV_plane_jet_sky_clouds_sand_valley_beach = new ScalarProperty { Name = "LTV_plane_jet_sky_clouds_sand_valley_beach", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_plane_jet_sky_clouds_sand_valley_beach);
             	    ScalarProperty LTV_grass_sky_tree_water_rocks_rodent_bear = new ScalarProperty { Name = "LTV_grass_sky_tree_water_rocks_rodent_bear", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_grass_sky_tree_water_rocks_rodent_bear);
             	    ScalarProperty LTV_sky_jet_plane_mountain_water_park_buildings = new ScalarProperty { Name = "LTV_sky_jet_plane_mountain_water_park_buildings", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_jet_plane_mountain_water_park_buildings);
             	    ScalarProperty LTV_sky_plane_mountain_prop_tree_palace_water = new ScalarProperty { Name = "LTV_sky_plane_mountain_prop_tree_palace_water", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_plane_mountain_prop_tree_palace_water);
             	    ScalarProperty LTV_sky_clouds_plane_jet_train_railroad_locomotive = new ScalarProperty { Name = "LTV_sky_clouds_plane_jet_train_railroad_locomotive", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_clouds_plane_jet_train_railroad_locomotive);
             	    ScalarProperty LTV_sky_jet_plane_water_valley_desert_sand = new ScalarProperty { Name = "LTV_sky_jet_plane_water_valley_desert_sand", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_jet_plane_water_valley_desert_sand);
             	    ScalarProperty LTV_bear_snow_polar_ice_people_water_tracks = new ScalarProperty { Name = "LTV_bear_snow_polar_ice_people_water_tracks", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_bear_snow_polar_ice_people_water_tracks);
             	    ScalarProperty LTV_sky_plane_jet_tree_mountain_clouds_valley = new ScalarProperty { Name = "LTV_sky_plane_jet_tree_mountain_clouds_valley", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_plane_jet_tree_mountain_clouds_valley);
             	    ScalarProperty LTV_water_sunset_coast_horizon_sun_tree_clouds = new ScalarProperty { Name = "LTV_water_sunset_coast_horizon_sun_tree_clouds", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_water_sunset_coast_horizon_sun_tree_clouds);
             	    ScalarProperty LTV_tree_people_sky_buildings_water_rocks_mountain = new ScalarProperty { Name = "LTV_tree_people_sky_buildings_water_rocks_mountain", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_tree_people_sky_buildings_water_rocks_mountain);
             	    ScalarProperty LTV_snow_water_sky_bear_stone_polar_sand = new ScalarProperty { Name = "LTV_snow_water_sky_bear_stone_polar_sand", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_snow_water_sky_bear_stone_polar_sand);
             	    ScalarProperty LTV_water_people_swimmers_pool_tree_plants_leaf = new ScalarProperty { Name = "LTV_water_people_swimmers_pool_tree_plants_leaf", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_water_people_swimmers_pool_tree_plants_leaf);
             	    ScalarProperty LTV_tree_water_sky_mountain_buildings_people_rocks = new ScalarProperty { Name = "LTV_tree_water_sky_mountain_buildings_people_rocks", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_tree_water_sky_mountain_buildings_people_rocks);
             	    ScalarProperty LTV_tree_flowers_rose_frost_ice_plants_mountain = new ScalarProperty { Name = "LTV_tree_flowers_rose_frost_ice_plants_mountain", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_tree_flowers_rose_frost_ice_plants_mountain);
             	    ScalarProperty LTV_sky_birds_flight_eagle_mountain_snow_clouds = new ScalarProperty { Name = "LTV_sky_birds_flight_eagle_mountain_snow_clouds", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_birds_flight_eagle_mountain_snow_clouds);
             	    ScalarProperty LTV_sky_jet_plane_branch_birds_sand_tree = new ScalarProperty { Name = "LTV_sky_jet_plane_branch_birds_sand_tree", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_jet_plane_branch_birds_sand_tree);
             	    ScalarProperty LTV_cars_tracks_ice_water_formula_wall_turn = new ScalarProperty { Name = "LTV_cars_tracks_ice_water_formula_wall_turn", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_cars_tracks_ice_water_formula_wall_turn);
             	    ScalarProperty LTV_mountain_tree_bridge_sky_water_clouds_arch = new ScalarProperty { Name = "LTV_mountain_tree_bridge_sky_water_clouds_arch", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_mountain_tree_bridge_sky_water_clouds_arch);
             	    ScalarProperty LTV_people_temple_scotland_stone_grass_water_pillar = new ScalarProperty { Name = "LTV_people_temple_scotland_stone_grass_water_pillar", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_people_temple_scotland_stone_grass_water_pillar);
             	    ScalarProperty LTV_sand_people_close__up_lizard_grass_tree_field = new ScalarProperty { Name = "LTV_sand_people_close__up_lizard_grass_tree_field", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sand_people_close__up_lizard_grass_tree_field);
             	    ScalarProperty LTV_sand_stone_rocks_polar_bear_sky_snow = new ScalarProperty { Name = "LTV_sand_stone_rocks_polar_bear_sky_snow", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sand_stone_rocks_polar_bear_sky_snow);
             	    ScalarProperty LTV_water_sky_jet_mountain_plane_train_buildings = new ScalarProperty { Name = "LTV_water_sky_jet_mountain_plane_train_buildings", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_water_sky_jet_mountain_plane_train_buildings);
             	    ScalarProperty LTV_flowers_tree_birds_grass_leaf_plants_nest = new ScalarProperty { Name = "LTV_flowers_tree_birds_grass_leaf_plants_nest", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_flowers_tree_birds_grass_leaf_plants_nest);
             	    ScalarProperty LTV_water_sky_grass_people_tree_mountain_snow = new ScalarProperty { Name = "LTV_water_sky_grass_people_tree_mountain_snow", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_water_sky_grass_people_tree_mountain_snow);
             	    ScalarProperty LTV_people_polar_bear_face_water_snow_buildings = new ScalarProperty { Name = "LTV_people_polar_bear_face_water_snow_buildings", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_people_polar_bear_face_water_snow_buildings);
             	    ScalarProperty LTV_leaf_plants_flowers_garden_birds_tree_nest = new ScalarProperty { Name = "LTV_leaf_plants_flowers_garden_birds_tree_nest", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_leaf_plants_flowers_garden_birds_tree_nest);
             	    ScalarProperty LTV_buildings_people_city_water_sky_statue_night = new ScalarProperty { Name = "LTV_buildings_people_city_water_sky_statue_night", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_buildings_people_city_water_sky_statue_night);
             	    ScalarProperty LTV_stone_pillar_sculpture_people_statue_tree_road = new ScalarProperty { Name = "LTV_stone_pillar_sculpture_people_statue_tree_road", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_stone_pillar_sculpture_people_statue_tree_road);
             	    ScalarProperty LTV_sky_water_sand_beach_people_hills_tree = new ScalarProperty { Name = "LTV_sky_water_sand_beach_people_hills_tree", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_water_sand_beach_people_hills_tree);
             	    ScalarProperty LTV_sky_jet_plane_train_railroad_locomotive_pagoda = new ScalarProperty { Name = "LTV_sky_jet_plane_train_railroad_locomotive_pagoda", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_jet_plane_train_railroad_locomotive_pagoda);
             	    ScalarProperty LTV_jet_plane_sky_beach_boats_steel_courtyard = new ScalarProperty { Name = "LTV_jet_plane_sky_beach_boats_steel_courtyard", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_jet_plane_sky_beach_boats_steel_courtyard);
             	    ScalarProperty LTV_plane_sky_prop_bridge_valley_boats_sand = new ScalarProperty { Name = "LTV_plane_sky_prop_bridge_valley_boats_sand", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_plane_sky_prop_bridge_valley_boats_sand);
             	    ScalarProperty LTV_plane_clouds_jet_sky_mountain_water_snow = new ScalarProperty { Name = "LTV_plane_clouds_jet_sky_mountain_water_snow", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_plane_clouds_jet_sky_mountain_water_snow);
             	    ScalarProperty LTV_snow_bear_polar_water_rocks_fox_sand = new ScalarProperty { Name = "LTV_snow_bear_polar_water_rocks_fox_sand", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_snow_bear_polar_water_rocks_fox_sand);
             	    ScalarProperty LTV_sky_water_people_tree_sand_swimmers_clouds = new ScalarProperty { Name = "LTV_sky_water_people_tree_sand_swimmers_clouds", DataType =DataTypes.Double };
             	    Corel5Image2.ScalarProperties.Add(LTV_sky_water_people_tree_sand_swimmers_clouds);
             	    ScalarProperty Tag_reefs = new ScalarProperty { Name = "Tag_reefs", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_reefs);
             	    ScalarProperty Tag_birds = new ScalarProperty { Name = "Tag_birds", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_birds);
             	    ScalarProperty Tag_ground = new ScalarProperty { Name = "Tag_ground", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_ground);
             	    ScalarProperty Tag_hills = new ScalarProperty { Name = "Tag_hills", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_hills);
             	    ScalarProperty Tag_rose = new ScalarProperty { Name = "Tag_rose", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_rose);
             	    ScalarProperty Tag_sky = new ScalarProperty { Name = "Tag_sky", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_sky);
             	    ScalarProperty Tag_window = new ScalarProperty { Name = "Tag_window", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_window);
             	    ScalarProperty Tag_town = new ScalarProperty { Name = "Tag_town", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_town);
             	    ScalarProperty Tag_woman = new ScalarProperty { Name = "Tag_woman", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_woman);
             	    ScalarProperty Tag_garden = new ScalarProperty { Name = "Tag_garden", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_garden);
             	    ScalarProperty Tag_bear = new ScalarProperty { Name = "Tag_bear", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_bear);
             	    ScalarProperty Tag_coast = new ScalarProperty { Name = "Tag_coast", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_coast);
             	    ScalarProperty Tag_railroad = new ScalarProperty { Name = "Tag_railroad", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_railroad);
             	    ScalarProperty Tag_clouds = new ScalarProperty { Name = "Tag_clouds", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_clouds);
             	    ScalarProperty Tag_harbor = new ScalarProperty { Name = "Tag_harbor", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_harbor);
             	    ScalarProperty Tag_pillar = new ScalarProperty { Name = "Tag_pillar", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_pillar);
             	    ScalarProperty Tag_white__tailed = new ScalarProperty { Name = "Tag_white__tailed", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_white__tailed);
             	    ScalarProperty Tag_rocks = new ScalarProperty { Name = "Tag_rocks", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_rocks);
             	    ScalarProperty Tag_sand = new ScalarProperty { Name = "Tag_sand", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_sand);
             	    ScalarProperty Tag_man = new ScalarProperty { Name = "Tag_man", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_man);
             	    ScalarProperty Tag_night = new ScalarProperty { Name = "Tag_night", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_night);
             	    ScalarProperty Tag_tower = new ScalarProperty { Name = "Tag_tower", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_tower);
             	    ScalarProperty Tag_river = new ScalarProperty { Name = "Tag_river", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_river);
             	    ScalarProperty Tag_ruins = new ScalarProperty { Name = "Tag_ruins", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_ruins);
             	    ScalarProperty Tag_grizzly = new ScalarProperty { Name = "Tag_grizzly", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_grizzly);
             	    ScalarProperty Tag_people = new ScalarProperty { Name = "Tag_people", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_people);
             	    ScalarProperty Tag_house = new ScalarProperty { Name = "Tag_house", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_house);
             	    ScalarProperty Tag_village = new ScalarProperty { Name = "Tag_village", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_village);
             	    ScalarProperty Tag_sign = new ScalarProperty { Name = "Tag_sign", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_sign);
             	    ScalarProperty Tag_street = new ScalarProperty { Name = "Tag_street", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_street);
             	    ScalarProperty Tag_palm = new ScalarProperty { Name = "Tag_palm", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_palm);
             	    ScalarProperty Tag_zebra = new ScalarProperty { Name = "Tag_zebra", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_zebra);
             	    ScalarProperty Tag_sea = new ScalarProperty { Name = "Tag_sea", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_sea);
             	    ScalarProperty Tag_foals = new ScalarProperty { Name = "Tag_foals", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_foals);
             	    ScalarProperty Tag_leaf = new ScalarProperty { Name = "Tag_leaf", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_leaf);
             	    ScalarProperty Tag_dunes = new ScalarProperty { Name = "Tag_dunes", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_dunes);
             	    ScalarProperty Tag_sun = new ScalarProperty { Name = "Tag_sun", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_sun);
             	    ScalarProperty Tag_fox = new ScalarProperty { Name = "Tag_fox", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_fox);
             	    ScalarProperty Tag_skyline = new ScalarProperty { Name = "Tag_skyline", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_skyline);
             	    ScalarProperty Tag_ice = new ScalarProperty { Name = "Tag_ice", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_ice);
             	    ScalarProperty Tag_prop = new ScalarProperty { Name = "Tag_prop", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_prop);
             	    ScalarProperty Tag_indian = new ScalarProperty { Name = "Tag_indian", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_indian);
             	    ScalarProperty Tag_landscape = new ScalarProperty { Name = "Tag_landscape", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_landscape);
             	    ScalarProperty Tag_formula = new ScalarProperty { Name = "Tag_formula", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_formula);
             	    ScalarProperty Tag_temple = new ScalarProperty { Name = "Tag_temple", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_temple);
             	    ScalarProperty Tag_mare = new ScalarProperty { Name = "Tag_mare", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_mare);
             	    ScalarProperty Tag_roofs = new ScalarProperty { Name = "Tag_roofs", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_roofs);
             	    ScalarProperty Tag_cars = new ScalarProperty { Name = "Tag_cars", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_cars);
             	    ScalarProperty Tag_bulls = new ScalarProperty { Name = "Tag_bulls", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_bulls);
             	    ScalarProperty Tag_water = new ScalarProperty { Name = "Tag_water", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_water);
             	    ScalarProperty Tag_tracks = new ScalarProperty { Name = "Tag_tracks", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_tracks);
             	    ScalarProperty Tag_stone = new ScalarProperty { Name = "Tag_stone", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_stone);
             	    ScalarProperty Tag_island = new ScalarProperty { Name = "Tag_island", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_island);
             	    ScalarProperty Tag_coral = new ScalarProperty { Name = "Tag_coral", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_coral);
             	    ScalarProperty Tag_locomotive = new ScalarProperty { Name = "Tag_locomotive", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_locomotive);
             	    ScalarProperty Tag_turn = new ScalarProperty { Name = "Tag_turn", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_turn);
             	    ScalarProperty Tag_horizon = new ScalarProperty { Name = "Tag_horizon", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_horizon);
             	    ScalarProperty Tag_castle = new ScalarProperty { Name = "Tag_castle", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_castle);
             	    ScalarProperty Tag_road = new ScalarProperty { Name = "Tag_road", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_road);
             	    ScalarProperty Tag_wall = new ScalarProperty { Name = "Tag_wall", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_wall);
             	    ScalarProperty Tag_canyon = new ScalarProperty { Name = "Tag_canyon", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_canyon);
             	    ScalarProperty Tag_plants = new ScalarProperty { Name = "Tag_plants", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_plants);
             	    ScalarProperty Tag_church = new ScalarProperty { Name = "Tag_church", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_church);
             	    ScalarProperty Tag_swimmers = new ScalarProperty { Name = "Tag_swimmers", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_swimmers);
             	    ScalarProperty Tag_market = new ScalarProperty { Name = "Tag_market", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_market);
             	    ScalarProperty Tag_city = new ScalarProperty { Name = "Tag_city", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_city);
             	    ScalarProperty Tag_jet = new ScalarProperty { Name = "Tag_jet", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_jet);
             	    ScalarProperty Tag_tusks = new ScalarProperty { Name = "Tag_tusks", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_tusks);
             	    ScalarProperty Tag_valley = new ScalarProperty { Name = "Tag_valley", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_valley);
             	    ScalarProperty Tag_athlete = new ScalarProperty { Name = "Tag_athlete", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_athlete);
             	    ScalarProperty Tag_horses = new ScalarProperty { Name = "Tag_horses", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_horses);
             	    ScalarProperty Tag_flight = new ScalarProperty { Name = "Tag_flight", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_flight);
             	    ScalarProperty Tag_frost = new ScalarProperty { Name = "Tag_frost", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_frost);
             	    ScalarProperty Tag_park = new ScalarProperty { Name = "Tag_park", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_park);
             	    ScalarProperty Tag_lawn = new ScalarProperty { Name = "Tag_lawn", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_lawn);
             	    ScalarProperty Tag_tundra = new ScalarProperty { Name = "Tag_tundra", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_tundra);
             	    ScalarProperty Tag_hut = new ScalarProperty { Name = "Tag_hut", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_hut);
             	    ScalarProperty Tag_train = new ScalarProperty { Name = "Tag_train", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_train);
             	    ScalarProperty Tag_flowers = new ScalarProperty { Name = "Tag_flowers", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_flowers);
             	    ScalarProperty Tag_steel = new ScalarProperty { Name = "Tag_steel", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_steel);
             	    ScalarProperty Tag_frozen = new ScalarProperty { Name = "Tag_frozen", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_frozen);
             	    ScalarProperty Tag_runway = new ScalarProperty { Name = "Tag_runway", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_runway);
             	    ScalarProperty Tag_tree = new ScalarProperty { Name = "Tag_tree", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_tree);
             	    ScalarProperty Tag_cat = new ScalarProperty { Name = "Tag_cat", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_cat);
             	    ScalarProperty Tag_shops = new ScalarProperty { Name = "Tag_shops", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_shops);
             	    ScalarProperty Tag_grass = new ScalarProperty { Name = "Tag_grass", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_grass);
             	    ScalarProperty Tag_sculpture = new ScalarProperty { Name = "Tag_sculpture", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_sculpture);
             	    ScalarProperty Tag_display = new ScalarProperty { Name = "Tag_display", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_display);
             	    ScalarProperty Tag_bridge = new ScalarProperty { Name = "Tag_bridge", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_bridge);
             	    ScalarProperty Tag_palace = new ScalarProperty { Name = "Tag_palace", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_palace);
             	    ScalarProperty Tag_door = new ScalarProperty { Name = "Tag_door", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_door);
             	    ScalarProperty Tag_mountain = new ScalarProperty { Name = "Tag_mountain", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_mountain);
             	    ScalarProperty Tag_scotland = new ScalarProperty { Name = "Tag_scotland", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_scotland);
             	    ScalarProperty Tag_snow = new ScalarProperty { Name = "Tag_snow", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_snow);
             	    ScalarProperty Tag_field = new ScalarProperty { Name = "Tag_field", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_field);
             	    ScalarProperty Tag_forest = new ScalarProperty { Name = "Tag_forest", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_forest);
             	    ScalarProperty Tag_branch = new ScalarProperty { Name = "Tag_branch", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_branch);
             	    ScalarProperty Tag_boats = new ScalarProperty { Name = "Tag_boats", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_boats);
             	    ScalarProperty Tag_beach = new ScalarProperty { Name = "Tag_beach", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_beach);
             	    ScalarProperty Tag_polar = new ScalarProperty { Name = "Tag_polar", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_polar);
             	    ScalarProperty Tag_buildings = new ScalarProperty { Name = "Tag_buildings", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_buildings);
             	    ScalarProperty Tag_hotel = new ScalarProperty { Name = "Tag_hotel", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_hotel);
             	    ScalarProperty Tag_nest = new ScalarProperty { Name = "Tag_nest", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_nest);
             	    ScalarProperty Tag_petals = new ScalarProperty { Name = "Tag_petals", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_petals);
             	    ScalarProperty Tag_plane = new ScalarProperty { Name = "Tag_plane", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_plane);
             	    ScalarProperty Tag_statue = new ScalarProperty { Name = "Tag_statue", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_statue);
             	    ScalarProperty Tag_waves = new ScalarProperty { Name = "Tag_waves", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_waves);
             	    ScalarProperty Tag_arch = new ScalarProperty { Name = "Tag_arch", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_arch);
             	    ScalarProperty Tag_desert = new ScalarProperty { Name = "Tag_desert", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_desert);
             	    ScalarProperty Tag_pool = new ScalarProperty { Name = "Tag_pool", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_pool);
             	    ScalarProperty Tag_cliff = new ScalarProperty { Name = "Tag_cliff", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_cliff);
             	    ScalarProperty Tag_tiger = new ScalarProperty { Name = "Tag_tiger", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_tiger);
             	    ScalarProperty Tag_close__up = new ScalarProperty { Name = "Tag_close__up", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_close__up);
             	    ScalarProperty Tag_reflection = new ScalarProperty { Name = "Tag_reflection", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_reflection);
             	    ScalarProperty Tag_ocean = new ScalarProperty { Name = "Tag_ocean", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_ocean);
             	    ScalarProperty Tag_tulip = new ScalarProperty { Name = "Tag_tulip", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_tulip);
             	    ScalarProperty Tag_shore = new ScalarProperty { Name = "Tag_shore", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_shore);
             	    ScalarProperty Tag_sunset = new ScalarProperty { Name = "Tag_sunset", DataType =DataTypes.Boolean };
             	    Corel5Image2.ScalarProperties.Add(Tag_sunset);
             	    // Synchronize to alter the database schema.
             	    context.DataModel.Modules.Add(module);
             	    context.DataModel.Synchronize();

             	    // Generate Extensions Assembly.
             	    using (FileStream fout = new FileStream(@"../data/code/Zentity.Corel52.dll", FileMode.Create, FileAccess.Write))
             	 	 {
             	 	  byte[] rawAssembly = context.DataModel.GenerateExtensionsAssembly(
             	 	    "Zentity.Corel52", false, null, new string[] { "Zentity.Corel52" }, null);

             	 	   fout.Write(rawAssembly, 0, rawAssembly.Length);

              }
             	    // Generate Entity Framework artifacts.

             	    EFArtifactGenerationResults results = context.DataModel.GenerateEFArtifacts("Zentity.Corel52");
             	    results.Csdls.Where(tuple => tuple.Key == "Zentity.Core").First().Value.Save(@"../data/code/Zentity.Corel52.ExtendedCore.csdl");
             	    results.Csdls.Where(tuple => tuple.Key == "Zentity.Corel52").First().Value.Save(@"../data/code/Zentity.Corel52.csdl");
             	    results.Msl.Save(@"../data/code/Zentity.Corel52.Consolidated.msl");
             	    results.Ssdl.Save(@"../data/code/Zentity.Corel52.Consolidated.ssdl");
        }