generate ids, automap classes without ids and schema generation

Original Post Valko's Avatar

Valko

09 Mar, 2010 10:17 AM via web

Hi,

I have wsdl, using svcutil I automatically generate all my classes and interfaces for the service I need. I would like based on those classes to generate database schema too and to automap, here what I have so far:

           string connectionString = sysConfig.ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString;
            var config = GenerateMapping(connectionString);
            var model = AutoMap.AssemblyOf<cs_timeslot>()

.Where(t => t.Namespace == "lseisml");

            var sessionFactory = Fluently.Configure()
            .Database(MsSqlConfiguration.MsSql2008
            .ConnectionString(c => c
            .Is(connectionString)))
            .Mappings(m => m.AutoMappings.Add(model)).ExposeConfiguration(cfg =>

{

new SchemaExport(cfg)
  .Create(false, true);

}).BuildSessionFactory();

and:

   public static Configuration GenerateMapping(string connectionString)
    {
        var config = MsSqlConfiguration.MsSql2008
            .ConnectionString(c => c.Is(connectionString))
            .ConfigureProperties(new Configuration());
        AutoMap.AssemblyOf<lseisml.cs_timeslot>().Configure(config);
        return config;
    }

The problem is my classes do not have any id, ny question is: is it possible to generate the ids and then to automap and generate the schema too? I know I am lazy :-)

The final goal is to have as automated development as possible.

thank you

cheers
Valko

  1. Support Staff 2 Posted by Paul Batum on 11 Mar, 2010 06:04 AM

    Paul Batum's Avatar

    I'm not sure I understand what you mean by "generate the ids". These are YOUR classes - how are we supposed to generate ID properties for them? You can use automapping to generate mappings for your classes, but its your responsibility to write (or in this case, generate) the classes you want mapped.

  2. James Gregory resolved this discussion on 24 Mar, 2010 08:57 AM.

Comments are currently closed for this discussion. You can start a new one.

Recent Discussions

05 Jul, 2010 10:29 PM
05 Jul, 2010 12:45 PM
05 Jul, 2010 12:42 PM
05 Jul, 2010 12:17 PM
05 Jul, 2010 12:12 PM

 

03 Jul, 2010 12:26 AM
02 Jul, 2010 02:17 PM
02 Jul, 2010 08:18 AM
02 Jul, 2010 12:20 AM
01 Jul, 2010 10:14 PM