使用linq to sql 通过数据库生成实体类及基本业务类

sqlmetal /conn:server=".\mysql;database='AddDayDataContext';uid='sa';pwd='yaohaitao'" /namespace:AddDay.Web.Entities /dbml:d:\temps\AddDayDataContext.dbml /serialization:Unidirectional

 

测试代码:

            using (var addDayDataContext = new AddDay.Web.Entities.AddDayDataContext(
                  @"server=.\mysql;database=AddDayDataContext;uid=sa;pwd=yaohaitao"))
            {
                var internetBar = new Entities.InternetBar { 
                      InternetBarId = Guid.NewGuid(), Title = "dfdfdf" };

                addDayDataContext.InternetBar.InsertOnSubmit(internetBar);

                addDayDataContext.SubmitChanges();
            }
 

你可能感兴趣的:(sql,mysql,Web,SQL Server,LINQ)