Getting started

Topics: Customizing Orchard, Writing modules
Nov 12, 2011 at 2:23 PM

I am interested in getting started with Orchard, but haven’t had much luck so far with the only tutorial I could find. http://www.orchardproject.net/docs/Creating-a-module-with-a-simple-text-editor.ashx
I could not get past the Creating the Initial Data Migration File step, it gave me a error
CS1518 Expected class, delegate, enum, interface, struct, or union
Is this tutorial still current?
Is version 2.0 coming out soon, Would I be better waiting till version 2.0 before getting my hands dirty?
Looking for a bit of guidance
Thanks

Nov 12, 2011 at 3:25 PM

Can you show your code so we can see what is wrong? The tutorial is fine, nothing huge has changed in migrations in recent versions.

Nov 12, 2011 at 3:29 PM

i have messed with it a lot, i even tried atking out all code except for public class Migrations : DataMigrationImpl {} , but it still gives same error, i was thinging the error was in DataMigrationImpl.

Thanks

 

using System;
using System.Collections.Generic;
using System.Data;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;

namespace SimpleCommerce.DataMigrations
{
    public class Migrations : DataMigrationImpl
    {

        public int Create()
        {
            // Creating table ProductPartRecord
            SchemaBuilder.CreateTable("ProductPartRecord", table => table
                .ContentPartRecord()
                .Column("Sku", DbType.String)
                .Column("Price", DbType.Single)
            );

 

            return 1;
        }
    }
}

Developer
Nov 12, 2011 at 3:38 PM

Are you sure the error is in this file ?

This error message often occurs when there is an extra closing bracket or a problem like that.

Nov 12, 2011 at 3:55 PM

Yes i know, thats why i could not work it out, i opened in VS2010, and it did not show any errors.

Look i just went back into the project and tried again and it compiled and ran, but when i added

public int UpdateFrom1() {
  ContentDefinitionManager.AlterPartDefinition("ProductPart",
    builder => builder.Attachable());
  return 2;
}

it erred again.

this is the step that stoped me yesterday.

I take it out again, back to where it last ran, and still get the error.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1513: } expected

Source Error:

 
Line 20:                 .Column("Sku", DbType.String)
Line 21:                 .Column("Price", DbType.Single)
Line 22:             );
Line 23: 
Line 24: 


Source File: c:\Sites\Orchard\Modules\SimpleCommerce\Migrations.cs Line: 22

 

 

Nov 12, 2011 at 4:01 PM

Very strange; try cleaning and rebuilding your solution in VS2010. There shouldn't be anything wrong with the code, and certainly not with core parts of Orchard like DataMigrationImpl (which works for all other modules).

Do you have a full source enlistment? Best to get one from Codeplex if not.

Nov 12, 2011 at 4:04 PM

Yes maybe tomorrow, i will delete the lot and try again, what about version 2.0, is the an ETA, I was thinking of waiting till then?