{"id":16428519,"url":"https://github.com/buraksenyurt/odata-challenge","last_synced_at":"2026-05-08T02:03:33.053Z","repository":{"id":168309119,"uuid":"643756477","full_name":"buraksenyurt/odata-challenge","owner":"buraksenyurt","description":"OData servislerinde birden fazla resource kullanımının nasıl yapılabileceğini göstermeyi amaçlayan örnek uygulamadır.","archived":false,"fork":false,"pushed_at":"2023-05-23T16:29:44.000Z","size":162,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-17T15:57:55.303Z","etag":null,"topics":["csharp","dotnet-core","entity-framework-core","odata","sql-server"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buraksenyurt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-22T05:07:25.000Z","updated_at":"2023-06-05T12:51:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"ebb7d8bd-99d3-4500-b611-f83599962bf8","html_url":"https://github.com/buraksenyurt/odata-challenge","commit_stats":null,"previous_names":["buraksenyurt/odata-challenge"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buraksenyurt%2Fodata-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buraksenyurt%2Fodata-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buraksenyurt%2Fodata-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buraksenyurt%2Fodata-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buraksenyurt","download_url":"https://codeload.github.com/buraksenyurt/odata-challenge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240617445,"owners_count":19829985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet-core","entity-framework-core","odata","sql-server"],"created_at":"2024-10-11T08:17:22.381Z","updated_at":"2026-05-08T02:03:28.014Z","avatar_url":"https://github.com/buraksenyurt.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OData Challenge\n\nOData servislerinde birden fazla resource kullanımını amaçlayan örnek uygulama. Senaryoda Kategoriler, Ürünler ve Siparişlerin tutulduğu ilkel bir senaryo söz konusu. Bu senaryoda amaç aşağıdaki gibi bir sorgunun OData hizmeti olarak REST tabanlı bir servis üzerinden sunulabileceğini göstermektir.\n\n- Kategoriler altındaki ürünler ve bu ürünler için verilen siparişlerin listelenmesinin sağlanması. Yani şuna bir benzer querystring yollamak istiyoruz -\u003e *category?$expand=Products($select=Name,ListPrice,InStock;$expand=Orders($select=CustomerID,OrderDate,Quantity))*\n\n## Ön Hazırlıklar\n\nBu örnekte SQL Server veritabanı kullanılmakta. Onu bir docker imaj olarak kullanabiliriz. Diğer yandan kod tarafından veritabanı nesnelerinin oluşturulması (migration) için de Entity Framework komut satırı aracından yararlanılmakta. Gerekli hazırlıkları aşağıdaki gibi yapabiliriz.\n\n```bash\n# SQL docker örneğini başlatmak için (Şifreyi siz istediğiniz gibi verebilir veya aynısını kullanabilirsiniz)\nsudo docker run -e \"ACCEPT_EULA=Y\" -e \"SA_PASSWORD=tig@r76!\" -p 1434:1433 --name sql-south --hostname sql-south -d mcr.microsoft.com/mssql/server:2022-latest\n\n# Migration için EF tool'a ihtiyacımız olacaktır\ndotnet tool install -g dotnet-ef\n\n# Bu komutları MusicLibrary.Data klasörü içerisindeyken çalıştırabiliriz.\ndotnet ef migrations add Initial --startup-project ../SouthWind.Service\ndotnet ef database update --startup-project ..//SouthWind.Service\n```\n\n## Çalışma Zamanı\n\nÖncelikle SQL docker container'ının çalışır olduğundan emin olmak lazım. Sonrasında en azından veri çekebilmek için Migration planlarının işletildiğinden. Bu işlemlerde bir sıkıntı yoksa SouthWind.Service isimli .Net uygulamasının çalıştırılması yeterlidir.\n\n```bash\ndotnet run\n```\n\n![assets\\runtime_01.png](assets/runtime_01.png)\n\nBu sorgunun çalışması sırasında EF tarafında da aşağıdaki SQL sorgusu çalıştırılacaktır.\n\n```sql\nSELECT [c].[Id], [c].[Description], [c].[Name], [t].[Id], [t].[CustomerId], [t].[OrderDate], [t].[Quantity], [t].[Id0], [t].[Name], [t].[ListPrice], [t].[InStock]\n      FROM [Categories] AS [c]\n      LEFT JOIN (\n          SELECT [p].[Id], [o].[CustomerId], [o].[OrderDate], [o].[Quantity], [o].[Id] AS [Id0], [p].[Name], [p].[ListPrice], [p].[InStock], [p].[CategoryId]\n          FROM [Products] AS [p]\n          LEFT JOIN [Orders] AS [o] ON [p].[Id] = [o].[ProductId]\n      ) AS [t] ON [c].[Id] = [t].[CategoryId]\n      ORDER BY [c].[Id], [t].[Id]\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburaksenyurt%2Fodata-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fburaksenyurt%2Fodata-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fburaksenyurt%2Fodata-challenge/lists"}