Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeSql使用xamarin form建立工程相关经验分享 #569

Closed
densen2014 opened this issue Nov 26, 2020 · 5 comments
Closed

FreeSql使用xamarin form建立工程相关经验分享 #569

densen2014 opened this issue Nov 26, 2020 · 5 comments
Labels
docs This is a document xamarin form

Comments

@densen2014
Copy link
Member

densen2014 commented Nov 26, 2020

参考


使用sqlite
#183
Xamarin IOS 错误:Encoding 936 data could not be found
#126
Xamarin 下使用问题汇总
#124
xamarinFormApp例子,安卓,iOS,WPF
https://github.com/dotnetcore/FreeSql/tree/master/Examples/xamarinFormApp



                #region mssql测试没问题

                //        fsql = new FreeSql.FreeSqlBuilder()
                //.UseConnectionString(FreeSql.DataType.SqlServer, "Data Source=192.168.1.100;Initial Catalog=demo;Persist Security Info=True;MultipleActiveResultSets=true;User ID=sa;Password=a123456;Connect Timeout=30;min pool size=1;connection lifetime=15")
                //.UseAutoSyncStructure(true) //自动同步实体结构【开发环境必备】
                //.UseMonitorCommand(cmd => Console.Write(cmd.CommandText))
                //.Build();

                #endregion

                #region Sqlite需要反射,明天有时间再补充代码

                //                fsql = new FreeSql.FreeSqlBuilder()
                //.UseConnectionString(FreeSql.DataType.Sqlite, "Data Source=document.db; Pooling=true;Min Pool Size=1")
                //.UseAutoSyncStructure(true) //自动同步实体结构【开发环境必备】
                //.UseMonitorCommand(cmd => Console.Write(cmd.CommandText))
                //.Build();

                #endregion

                #region mysql使用 reeSql.Provider.MySqlConnector , debug和release都设置为不链接即可

                fsql = new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.MySql, "Data Source=192.168.1.100;Port=3306;User ID=root;Password=a123456; Initial Catalog=test;Charset=utf8; SslMode=none;Min pool size=1")
.UseAutoSyncStructure(true) //自动同步实体结构【开发环境必备】
.UseMonitorCommand(cmd => Console.Write(cmd.CommandText))
.Build();
                #endregion

                fsql.CodeFirst.SyncStructure<Item>();
                if (fsql.Select<Item>().Count()<10) fsql.Insert<Item>().AppendData(items).ExecuteAffrows();
                var res = fsql.Select<Item>().ToList(a=>a.Text);
                res.ForEach(a => {
                    Debug.WriteLine(" <== 测试测试测试 ==> " + a);
                });
@densen2014

This comment has been minimized.

@densen2014

This comment has been minimized.

@zhangboyanzhangboyan
Copy link

mssql
使用安卓设备管理器下的模拟系统,sqlserver本地数据库连不上
【主库】状态不可用,等待后台检查程序恢复方可使用。A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)

@2881099
Copy link
Collaborator

2881099 commented Feb 6, 2021

分别用 FreeSql.Provider.SqlServer.dll 和 FreeSql.Provider.SqlServerForSystem.dll 试试

mssql
使用安卓设备管理器下的模拟系统,sqlserver本地数据库连不上
【主库】状态不可用,等待后台检查程序恢复方可使用。A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)

@densen2014
Copy link
Member Author

densen2014 commented Feb 6, 2021

mssql
使用安卓设备管理器下的模拟系统,sqlserver本地数据库连不上
【主库】状态不可用,等待后台检查程序恢复方可使用。A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 40 - Could not open a connection to SQL Server)

先跑一下demo
https://github.com/dotnetcore/FreeSql/tree/master/Examples/xamarinFormApp

代码发出来看看,不会写的是连接localhost吧?要连ip

@luoyunchong luoyunchong added the docs This is a document label Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This is a document xamarin form
Projects
None yet
Development

No branches or pull requests

4 participants