public static DataSet Example ()
		{
			var connectionDetails = 
				ConfigurationManager.ConnectionStrings ["MyDatabase"];

			var providerName = connectionDetails.ProviderName;
			var connectionString = connectionDetails.ConnectionString;
			var dbFactory = DbProviderFactories.GetFactory (providerName);   

			var adapter = dbFactory.CreateDataAdapter ();

			// Fill	
			var myDataSet = new MyDataSet ();
			var myTable = new MyDataSet.MyTableDataTable ();     

			adapter.Fill (myTable);     

			foreach (MyDataSet.MyTableRow myTableRow in myTable) {
				var id = myTableRow.Id;
				var name = myTableRow.Name;
				var isMale = myTableRow.IsMale;
			}

			// insert
			MyDataSet.MyTableRow newRow = myTable.NewMyTableRow ();          

			newRow.Name = "Bobby McFroggy";     
			newRow.Id = 1;     
			newRow.IsMale = true;     

			myTable.AddMyTableRow (newRow);     

			myTable.AddMyTableRow (2, "James Pond", true);	

			adapter.Update (myTable);   
		
			return myDataSet;
		}
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     MyDataSet ds = new MyDataSet();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "EmployeeDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     MyDataSet ds = new MyDataSet();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
    // 画面レイアウト
    void OnGUI()
    {
        if (_data == null) {
            // データの読み込み
            _data = AssetDatabase.LoadAssetAtPath(DataPath, typeof(MyDataSet)) as MyDataSet;
            if(_data == null)
            {
                _data = ScriptableObject.CreateInstance<MyDataSet>() as MyDataSet;
                AssetDatabase.CreateAsset(_data, DataPath);
                AssetDatabase.Refresh();
            }
        }

        EditorGUILayout.BeginHorizontal();

        // 要素の追加ボタン
        Color mainColor = GUI.color;
        GUI.color = Color.green;
        if (GUILayout.Button("+", GUILayout.Width(20))) {
            MyData addData = new MyData();
            MyData[] copy = new MyData[_data.list.Count];
            Array.Copy(_data.list.ToArray(), copy, _data.list.Count);
            Array.Sort(copy, (MyData a, MyData b)=>{ return a.id - b.id; });
            int newId = (copy!=null && copy.Length>0) ? copy[0].id : 0;
            // 最小のモンスターIDを探す
            for (int i=0; i<copy.Length; i++)
            {
                if (newId < copy[i].id) {
                    break;
                }
                else {
                    newId++;
                }
            }
            addData.id = newId;

            // データの追加
            _data.list.Insert(newId, addData);
        }
        GUI.color = mainColor;

        // 要素のコピー
        GUI.color = (copyInstance==null) ? Color.white : Color.green;
        if (GUILayout.Button("copy", GUILayout.Width(50))) {
            if (selected != -1)
            {
                copyInstance = (MyData)_data.list[selected].Clone();
                Debug.Log("copy : " + copyInstance.id + "  " +  copyInstance.name);
            }
        }
        GUI.color = mainColor;

        // 要素のペースト
        GUI.color = (copyInstance==null ? Color.white : Color.green);
        if (GUILayout.Button("paste", GUILayout.Width(50))) {
            if (selected != -1)
            {
                int pasteId = _data.list[selected].id;
                copyInstance.id = pasteId;
                _data.list[selected] = copyInstance;
                Debug.Log("paste : " + copyInstance.id + "  " +  copyInstance.name);
            }
        }
        GUI.color = mainColor;

        EditorGUILayout.EndHorizontal();

        scrollPos = GUILayout.BeginScrollView(scrollPos);
        Color orgCol = GUI.backgroundColor;

        // 配置オブジェクトのリストを表示
        if (_data != null && _data.list != null && _data.list.Count > 0)
        {
            for(int i = 0; i < _data.list.Count; i++) {
                orgCol = GUI.backgroundColor;
                GUI.backgroundColor = _data.list[i].color;// 色設定

                GUILayout.BeginHorizontal();
                bool prev = i == selected;
                if (prev) GUI.backgroundColor = Color.magenta;
                bool flag = GUILayout.Toggle((i == selected), _data.list[i].id.ToString() + " : " + _data.list[i].name, "BoldLabel");

                GUI.backgroundColor = orgCol;
                if (GUILayout.Button("Edit",GUILayout.Width(60))) {
                    isEditMode = !isEditMode;
                    selected = i;// 選択中にする
                }
                GUI.backgroundColor = Color.red;
                if (GUILayout.Button("Remove", GUILayout.Width(60))) {
                    // 削除確認のダイアログ
                    bool result = EditorUtility.DisplayDialog(
                        "Remove",
                        "Remove this object.",
                        "OK",
                        "Cancel");

                    if(result){
                        _data.list.RemoveAt(i);
                        GUI.FocusControl("");
                    }
                }
                GUI.backgroundColor = orgCol;
                EditorGUILayout.EndHorizontal();
                if (flag){
                    selected = i;

                    // 編集モード
                    if (isEditMode){
                        // TODO : 変数代入のエディタスクリプトを記述
                        int id_new				= EditorGUILayout.IntField("\tid", _data.list[i].id);
                        if (id_new != _data.list[i].id)
                        {
                            // すでにIDが使われていないかチェック
                            if (_data.list.Find(a=>a.id==id_new) == null)
                                _data.list[i].id = id_new;
                        }

                        _data.list[i].name		= EditorGUILayout.TextField("\tname", _data.list[i].name);
                        _data.list[i].image		= EditorGUILayout.ObjectField("\timage", _data.list[i].image, typeof(Texture2D), true) as Texture2D;
                        _data.list[i].color		= EditorGUILayout.ColorField("\tcolor", _data.list[i].color);
                        _data.list[i].type		= (int)Enum.ToObject(typeof(MyData.Type), EditorGUILayout.EnumPopup("\ttype", (MyData.Type)_data.list[i].type));
                    }
                }
                else{
                    // トグルを二度押ししたら非選択状態にする
                    if (prev){
                        selected = -1;
                        isEditMode = false;
                    }
                }
                GUI.color = orgCol;
            }
        }

        // スクロールバー終了
        GUILayout.EndScrollView();
        // Apply Data
        ScriptableObject scriptable = AssetDatabase.LoadAssetAtPath(DataPath, typeof(ScriptableObject)) as ScriptableObject;
        EditorUtility.SetDirty(scriptable);
    }