コード例 #1
0
        protected static void CreateCustomOrderFields()
        {
            // You need an instance of the MetadataMananger in order to add the new meta field to the tables.
            MetadataManager metaManager = MetadataManager.GetManager();

            // Check if the CartOrder table has already been modified to contain meta fields
            if (metaManager.GetMetaType(typeof(CartOrder)) == null)
            {
                // Create the metatype for the CartOrder class.
                metaManager.CreateMetaType(typeof(CartOrder));

                //Save the changes.
                metaManager.SaveChanges();
            }

            // Add a new meta field to the CartOrder table
            App.WorkWith()
            .DynamicData()
            .Type(typeof(CartOrder))
            .Field()
            .TryCreateNew("DonationAmount", typeof(decimal))
            .SaveChanges(true);
        }