Try our conversational search powered by Generative AI!

DDS: ValidateAgainstMappings returns incorrect after remap

Found in

Release 7

Created

Oct 27, 2014

Updated

Nov 14, 2014

Area

Falcon/CMS/Core

State

Closed, Fixed and Tested


Steps to reproduce

Steps to reproduce:

1. Create a controller that remaps a specific type (see code below)

2. Create a class that inherits from IIdentity

3. Create an instance of the class in (2), and save it to DDS.

4. Add new property to the class (2).

5. Write code that gets all items from the store created in (3) inside a controller.

6. Start the site again and browse to the controller (5). A remap exception should now appeare (correct)

7. Call the remap method in the DdsRemapTypeController with the type created in (2). Observe that the StoreDefinition looks correct after remap.

8. Go to the controller, which gets the items from the store again (5).

 

Now we get that same remap error again, even if have remapped the store.

 

9. Restart the site, and go to the controller (5). The data are correctly displayed.

 

1:

public class DdsRemapTypeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Remap(string typeName)
        {
            var result = new RemapResult();
            var type = Type.GetType(typeName, false, true);

            if (type != null)
            {
                var storeName = DynamicDataStoreFactory.Instance.GetStoreNameForType(type);
                var storeDefinition = StoreDefinition.Get(storeName);

                if (storeDefinition != null)
                {
                    storeDefinition.Remap(type);
                    storeDefinition.CommitChanges();
                    StoreDefinition.DeleteFromCache(storeName);
                    result.Message = "Store successfully remapped to type!";
                    result.Success = true;
                }
                else
                {
                    result.Message = "Store not found for type!";
                }

            }
            else
            {
                result.Message = "Type could not be loaded!";
            }

            TempData["Result"] = result;
            return View("Index");
        }

 

2:

    public class TestData : IDynamicData
    {

        public Identity Id { get; set; }
        public string AString { get; set; }
        public int AnInt { get; set; }
    }