Exemplo n.º 1
0
		public DLinqDataModelProvider (Func<object> factory)
		{
			this.factory = factory;
			Type type = CreateContext ().GetType ();

			if (!typeof (DataContext).IsAssignableFrom (type))
				throw new ArgumentException (String.Format ("Type '{0}' is not supported as data context factory", type));

			this.factory = factory;

			model = new AttributeMappingSource ().GetModel (type);
			ContextType = model.ContextType;

			var l = new List<TableProvider> ();
			foreach (var m in model.GetTables ())
				l.Add (new DLinqTableProvider (this, m));
			tables = new ReadOnlyCollection<TableProvider> (l);
		}
Exemplo n.º 2
0
        public DLinqDataModelProvider(Func <object> factory)
        {
            this.factory = factory;
            Type type = CreateContext().GetType();

            if (!typeof(DataContext).IsAssignableFrom(type))
            {
                throw new ArgumentException(String.Format("Type '{0}' is not supported as data context factory", type));
            }

            this.factory = factory;

            model       = new AttributeMappingSource().GetModel(type);
            ContextType = model.ContextType;

            var l = new List <TableProvider> ();

            foreach (var m in model.GetTables())
            {
                l.Add(new DLinqTableProvider(this, m));
            }
            tables = new ReadOnlyCollection <TableProvider> (l);
        }
Exemplo n.º 3
0
        private string DeleteDatabaseSQL(
            MetaModel model)
        {
            StringBuilder commandBuilder = new StringBuilder();

            // Append the SQL for deleting the tables
            foreach (MetaTable table in model.GetTables())
            {
                commandBuilder.Append(m_builder.DeleteTableSQL(table));
                commandBuilder.Append("\r\n");
            }

            return commandBuilder.ToString();
        }